refactor(project_management): Update all references to User
to use get_user_model()
ref: #756 #755
This commit is contained in:
@ -1,4 +1,3 @@
|
|||||||
from django.contrib.auth.models import User
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from access.fields import AutoCreatedField
|
from access.fields import AutoCreatedField
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from django.contrib.auth.models import User
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
from access.models.team import Team
|
from access.models.team import Team
|
||||||
@ -152,7 +152,7 @@ class Project(ProjectCommonFieldsName):
|
|||||||
)
|
)
|
||||||
|
|
||||||
manager_user = models.ForeignKey(
|
manager_user = models.ForeignKey(
|
||||||
User,
|
settings.AUTH_USER_MODEL,
|
||||||
blank= True,
|
blank= True,
|
||||||
help_text = 'User who is the Project Manager',
|
help_text = 'User who is the Project Manager',
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
@ -173,7 +173,7 @@ class Project(ProjectCommonFieldsName):
|
|||||||
model_notes = None
|
model_notes = None
|
||||||
|
|
||||||
team_members = models.ManyToManyField(
|
team_members = models.ManyToManyField(
|
||||||
to = User,
|
to = settings.AUTH_USER_MODEL,
|
||||||
blank = True,
|
blank = True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission, User
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
@ -17,6 +18,8 @@ from project_management.models.projects import Project
|
|||||||
|
|
||||||
from settings.models.app_settings import AppSettings
|
from settings.models.app_settings import AppSettings
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ViewSetBase:
|
class ViewSetBase:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission, User
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
@ -14,6 +15,8 @@ from api.tests.abstract.test_metadata_functional import MetadataAttributesFuncti
|
|||||||
|
|
||||||
from project_management.models.project_milestone import Project, ProjectMilestone
|
from project_management.models.project_milestone import Project, ProjectMilestone
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ViewSetBase:
|
class ViewSetBase:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission, User
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
@ -16,6 +17,8 @@ from project_management.models.project_states import ProjectState
|
|||||||
|
|
||||||
from settings.models.app_settings import AppSettings
|
from settings.models.app_settings import AppSettings
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ViewSetBase:
|
class ViewSetBase:
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission, User
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
@ -16,6 +17,8 @@ from project_management.models.project_types import ProjectType
|
|||||||
|
|
||||||
from settings.models.app_settings import AppSettings
|
from settings.models.app_settings import AppSettings
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ViewSetBase:
|
class ViewSetBase:
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission, User
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
@ -22,6 +23,8 @@ from project_management.models.projects import Project, ProjectState, ProjectTyp
|
|||||||
|
|
||||||
from settings.models.user_settings import UserSettings
|
from settings.models.user_settings import UserSettings
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectAPI(
|
class ProjectAPI(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# from django.conf import settings
|
import django
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import AnonymousUser, Permission, User
|
from django.contrib.auth.models import AnonymousUser, Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import TestCase, Client
|
from django.test import TestCase, Client
|
||||||
@ -17,6 +17,9 @@ from app.tests.abstract.model_permissions import ModelPermissions
|
|||||||
|
|
||||||
from project_management.models.projects import Project
|
from project_management.models.projects import Project
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectPermissions(TestCase, ModelPermissions):
|
class ProjectPermissions(TestCase, ModelPermissions):
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
import unittest
|
import unittest
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from django.contrib.auth.models import AnonymousUser, Permission, User
|
from django.contrib.auth.models import AnonymousUser, Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
@ -14,6 +15,9 @@ from api.tests.abstract.api_permissions import APIPermissions
|
|||||||
|
|
||||||
from core.models.ticket.ticket_comment_category import TicketCommentCategory
|
from core.models.ticket.ticket_comment_category import TicketCommentCategory
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TicketCommentCategoryPermissionsAPI(TestCase, APIPermissions):
|
class TicketCommentCategoryPermissionsAPI(TestCase, APIPermissions):
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission, User
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
@ -18,6 +19,8 @@ from project_management.models.project_milestone import Project, ProjectMileston
|
|||||||
|
|
||||||
from settings.models.user_settings import UserSettings
|
from settings.models.user_settings import UserSettings
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectMilestoneAPI(
|
class ProjectMilestoneAPI(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# from django.conf import settings
|
import django
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import AnonymousUser, Permission, User
|
from django.contrib.auth.models import AnonymousUser, Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import TestCase, Client
|
from django.test import TestCase, Client
|
||||||
@ -17,6 +18,9 @@ from app.tests.abstract.model_permissions import ModelPermissions
|
|||||||
|
|
||||||
from project_management.models.project_milestone import Project, ProjectMilestone
|
from project_management.models.project_milestone import Project, ProjectMilestone
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectMilestonePermissions(TestCase, ModelPermissions):
|
class ProjectMilestonePermissions(TestCase, ModelPermissions):
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
import unittest
|
import unittest
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from django.contrib.auth.models import AnonymousUser, Permission, User
|
from django.contrib.auth.models import AnonymousUser, Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
@ -16,6 +17,9 @@ from api.tests.abstract.api_permissions import APIPermissions
|
|||||||
from project_management.models.projects import Project
|
from project_management.models.projects import Project
|
||||||
from project_management.models.project_milestone import Project, ProjectMilestone
|
from project_management.models.project_milestone import Project, ProjectMilestone
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectMilestonePermissionsAPI(TestCase, APIPermissions):
|
class ProjectMilestonePermissionsAPI(TestCase, APIPermissions):
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission, User
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
@ -20,6 +21,8 @@ from project_management.models.projects import ProjectState
|
|||||||
|
|
||||||
from settings.models.user_settings import UserSettings
|
from settings.models.user_settings import UserSettings
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectStateAPI(
|
class ProjectStateAPI(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# from django.conf import settings
|
import django
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import AnonymousUser, Permission, User
|
from django.contrib.auth.models import AnonymousUser, Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import TestCase, Client
|
from django.test import TestCase, Client
|
||||||
@ -17,6 +18,8 @@ from app.tests.abstract.model_permissions import ModelPermissions
|
|||||||
|
|
||||||
from project_management.models.project_states import ProjectState
|
from project_management.models.project_states import ProjectState
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class ProjectStatePermissions(TestCase, ModelPermissions):
|
class ProjectStatePermissions(TestCase, ModelPermissions):
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
import unittest
|
import unittest
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from django.contrib.auth.models import AnonymousUser, Permission, User
|
from django.contrib.auth.models import AnonymousUser, Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
@ -14,6 +15,8 @@ from api.tests.abstract.api_permissions import APIPermissions
|
|||||||
|
|
||||||
from project_management.models.project_states import ProjectState
|
from project_management.models.project_states import ProjectState
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectStatePermissionsAPI(TestCase, APIPermissions):
|
class ProjectStatePermissionsAPI(TestCase, APIPermissions):
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission, User
|
from django.contrib.auth.models import Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
@ -20,6 +21,8 @@ from project_management.models.project_types import ProjectType
|
|||||||
|
|
||||||
from settings.models.user_settings import UserSettings
|
from settings.models.user_settings import UserSettings
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectTypeAPI(
|
class ProjectTypeAPI(
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# from django.conf import settings
|
import django
|
||||||
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import AnonymousUser, Permission, User
|
from django.contrib.auth.models import AnonymousUser, Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.shortcuts import reverse
|
from django.shortcuts import reverse
|
||||||
from django.test import TestCase, Client
|
from django.test import TestCase, Client
|
||||||
@ -17,6 +18,9 @@ from app.tests.abstract.model_permissions import ModelPermissions
|
|||||||
|
|
||||||
from project_management.models.project_types import ProjectType
|
from project_management.models.project_types import ProjectType
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectTypePermissions(TestCase, ModelPermissions):
|
class ProjectTypePermissions(TestCase, ModelPermissions):
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
|
import django
|
||||||
import pytest
|
import pytest
|
||||||
import unittest
|
import unittest
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from django.contrib.auth.models import AnonymousUser, Permission, User
|
from django.contrib.auth.models import AnonymousUser, Permission
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
@ -14,6 +15,8 @@ from api.tests.abstract.api_permissions import APIPermissions
|
|||||||
|
|
||||||
from project_management.models.project_types import ProjectType
|
from project_management.models.project_types import ProjectType
|
||||||
|
|
||||||
|
User = django.contrib.auth.get_user_model()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectTypePermissionsAPI(TestCase, APIPermissions):
|
class ProjectTypePermissionsAPI(TestCase, APIPermissions):
|
||||||
|
Reference in New Issue
Block a user