Skip to content

Commit

Permalink
Fix hardcoded-auth-user errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ivo0126 authored and atodorov committed Nov 7, 2018
1 parent 91fcf22 commit d5484e2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions tcms/management/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

from django.db import models
from django.conf import settings

from tcms.core.models import TCMSActionModel

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tcms/testruns/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
3 changes: 2 additions & 1 deletion tcms/tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit d5484e2

Please sign in to comment.