diff --git a/tcms/management/models.py b/tcms/management/models.py index 656823131c..8143bc0b67 100755 --- a/tcms/management/models.py +++ b/tcms/management/models.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from django.db import models +from django.conf import settings from tcms.core.models import TCMSActionModel @@ -59,14 +60,14 @@ class Component(TCMSActionModel): name = models.CharField(max_length=64) product = models.ForeignKey(Product, related_name='component', on_delete=models.CASCADE) initial_owner = models.ForeignKey( - 'auth.User', + settings.AUTH_USER_MODEL, db_column='initialowner', related_name='initialowner', null=True, on_delete=models.CASCADE ) initial_qa_contact = models.ForeignKey( - 'auth.User', + settings.AUTH_USER_MODEL, db_column='initialqacontact', related_name='initialqacontact', blank=True, diff --git a/tcms/testruns/models.py b/tcms/testruns/models.py index 6dbdc55dfb..597ee38c74 100755 --- a/tcms/testruns/models.py +++ b/tcms/testruns/models.py @@ -56,7 +56,7 @@ class TestRun(TCMSActionModel): through='testruns.TestRunTag', related_name='run') - cc = models.ManyToManyField('auth.User', through='testruns.TestRunCC') + cc = models.ManyToManyField(settings.AUTH_USER_MODEL, through='testruns.TestRunCC') class Meta: unique_together = ('run_id', 'product_version') diff --git a/tcms/tests/factories.py b/tcms/tests/factories.py index 2aacbb614c..495d2dc890 100644 --- a/tcms/tests/factories.py +++ b/tcms/tests/factories.py @@ -4,6 +4,7 @@ from datetime import datetime from django.db.models import signals +from django.conf import settings import factory from factory.django import DjangoModelFactory @@ -20,7 +21,7 @@ class UserFactory(DjangoModelFactory): class Meta: - model = 'auth.User' + model = settings.AUTH_USER_MODEL username = factory.Sequence(lambda n: 'User%d' % n) email = factory.LazyAttribute(lambda user: '%s@example.com' % user.username)