diff --git a/backend/api/tests/api/utils.py b/backend/api/tests/api/utils.py index 1def595e..71953df1 100644 --- a/backend/api/tests/api/utils.py +++ b/backend/api/tests/api/utils.py @@ -10,7 +10,7 @@ from rest_framework.test import APITestCase from api.models import (DOCUMENT_CLASSIFICATION, IMAGE_CLASSIFICATION, INTENT_DETECTION_AND_SLOT_FILLING, SEQ2SEQ, SEQUENCE_LABELING, SPEECH2TEXT) -from members.models import Member +from projects.models import Member from roles.models import Role DATA_DIR = os.path.join(os.path.dirname(__file__), '../../../data_import/tests/data') diff --git a/backend/api/views/project.py b/backend/api/views/project.py index 6f06bca9..9110125c 100644 --- a/backend/api/views/project.py +++ b/backend/api/views/project.py @@ -4,7 +4,7 @@ from rest_framework import filters, generics, status from rest_framework.permissions import IsAdminUser, IsAuthenticated from rest_framework.response import Response -from members.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly +from projects.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly from ..models import Project from ..serializers import ProjectPolymorphicSerializer diff --git a/backend/api/views/tag.py b/backend/api/views/tag.py index d03e2e3b..e8f9adfe 100644 --- a/backend/api/views/tag.py +++ b/backend/api/views/tag.py @@ -1,7 +1,7 @@ from rest_framework import generics from rest_framework.permissions import IsAuthenticated -from members.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly +from projects.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly from ..models import Tag from ..serializers import TagSerializer diff --git a/backend/app/settings.py b/backend/app/settings.py index 611e8ca0..d18342e8 100644 --- a/backend/app/settings.py +++ b/backend/app/settings.py @@ -53,7 +53,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'api.apps.ApiConfig', 'roles.apps.RolesConfig', - 'members.apps.MembersConfig', + 'projects.apps.ProjectsConfig', 'metrics.apps.MetricsConfig', 'users.apps.UsersConfig', 'data_import.apps.DataImportConfig', diff --git a/backend/app/urls.py b/backend/app/urls.py index 87701384..44ad8a35 100644 --- a/backend/app/urls.py +++ b/backend/app/urls.py @@ -55,7 +55,7 @@ urlpatterns += [ path('v1/', include('users.urls')), path('v1/', include('data_import.urls')), path('v1/', include('data_export.urls')), - path('v1/projects//', include('members.urls')), + path('v1/projects//', include('projects.urls')), path('v1/projects//metrics/', include('metrics.urls')), path('v1/projects//', include('auto_labeling.urls')), path('v1/projects//', include('examples.urls')), diff --git a/backend/auto_labeling/views.py b/backend/auto_labeling/views.py index e98b27e5..81d5a88a 100644 --- a/backend/auto_labeling/views.py +++ b/backend/auto_labeling/views.py @@ -16,7 +16,7 @@ from rest_framework.response import Response from rest_framework.views import APIView from api.models import Project -from members.permissions import IsProjectMember, IsProjectAdmin +from projects.permissions import IsProjectMember, IsProjectAdmin from .pipeline.execution import execute_pipeline, get_label_collection from .exceptions import AWSTokenError, SampleDataException, TemplateMappingError, URLConnectionError from .models import AutoLabelingConfig diff --git a/backend/data_export/views.py b/backend/data_export/views.py index f10d1bca..edebc0cd 100644 --- a/backend/data_export/views.py +++ b/backend/data_export/views.py @@ -7,7 +7,7 @@ from rest_framework.response import Response from rest_framework.views import APIView from api.models import Project -from members.permissions import IsProjectAdmin +from projects.permissions import IsProjectAdmin from .celery_tasks import export_dataset from .pipeline.catalog import Options diff --git a/backend/data_import/views.py b/backend/data_import/views.py index 7d04690b..b31705b4 100644 --- a/backend/data_import/views.py +++ b/backend/data_import/views.py @@ -10,7 +10,7 @@ from rest_framework.views import APIView from api.models import Project -from members.permissions import IsProjectAdmin +from projects.permissions import IsProjectAdmin from .celery_tasks import import_dataset from .pipeline.catalog import Options diff --git a/backend/examples/views/comment.py b/backend/examples/views/comment.py index 2457a4e6..a96921e8 100644 --- a/backend/examples/views/comment.py +++ b/backend/examples/views/comment.py @@ -3,7 +3,7 @@ from rest_framework import filters, generics, status from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response -from members.permissions import IsProjectMember +from projects.permissions import IsProjectMember from examples.models import Comment from examples.permissions import IsOwnComment from examples.serializers import CommentSerializer diff --git a/backend/examples/views/example.py b/backend/examples/views/example.py index e3f4152b..654ce4c8 100644 --- a/backend/examples/views/example.py +++ b/backend/examples/views/example.py @@ -11,7 +11,7 @@ from api.models import Project from examples.filters import ExampleFilter from examples.models import Example from examples.serializers import ExampleSerializer -from members.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly +from projects.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly class ExampleList(generics.ListCreateAPIView): diff --git a/backend/examples/views/example_state.py b/backend/examples/views/example_state.py index 59f19867..41a42995 100644 --- a/backend/examples/views/example_state.py +++ b/backend/examples/views/example_state.py @@ -5,7 +5,7 @@ from rest_framework.permissions import IsAuthenticated from api.models import Project from examples.models import Example, ExampleState from examples.serializers import ExampleStateSerializer -from members.permissions import IsProjectMember +from projects.permissions import IsProjectMember class ExampleStateList(generics.ListCreateAPIView): diff --git a/backend/label_types/views.py b/backend/label_types/views.py index 3b041424..37af54ab 100644 --- a/backend/label_types/views.py +++ b/backend/label_types/views.py @@ -10,7 +10,7 @@ from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.views import APIView -from members.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly +from projects.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly from .models import LabelType, CategoryType, SpanType, RelationType from .exceptions import LabelValidationError from .serializers import (CategoryTypeSerializer, LabelSerializer, diff --git a/backend/labels/views.py b/backend/labels/views.py index c1e0f702..ab67aacd 100644 --- a/backend/labels/views.py +++ b/backend/labels/views.py @@ -8,7 +8,7 @@ from rest_framework.response import Response from api.models import Project from labels.models import Category, Span, TextLabel, Relation -from members.permissions import IsProjectMember +from projects.permissions import IsProjectMember from .permissions import CanEditLabel from .serializers import CategorySerializer, SpanSerializer, TextLabelSerializer, RelationSerializer diff --git a/backend/metrics/views.py b/backend/metrics/views.py index 6b665c89..140bccff 100644 --- a/backend/metrics/views.py +++ b/backend/metrics/views.py @@ -8,8 +8,8 @@ from rest_framework.views import APIView from examples.models import Example, ExampleState from label_types.models import LabelType, CategoryType, SpanType from labels.models import Label, Category, Span -from members.models import Member -from members.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly +from projects.models import Member +from projects.permissions import IsProjectAdmin, IsProjectStaffAndReadOnly class ProgressAPI(APIView): diff --git a/backend/members/__init__.py b/backend/projects/__init__.py similarity index 100% rename from backend/members/__init__.py rename to backend/projects/__init__.py diff --git a/backend/members/admin.py b/backend/projects/admin.py similarity index 100% rename from backend/members/admin.py rename to backend/projects/admin.py diff --git a/backend/members/apps.py b/backend/projects/apps.py similarity index 81% rename from backend/members/apps.py rename to backend/projects/apps.py index c0b5c1ca..9293907d 100644 --- a/backend/members/apps.py +++ b/backend/projects/apps.py @@ -4,12 +4,12 @@ from django.apps import AppConfig from django.db.models.signals import post_save -class MembersConfig(AppConfig): +class ProjectsConfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' - name = 'members' + name = 'projects' def ready(self): - importlib.import_module('members.signals') + importlib.import_module('projects.signals') from api.models import Project from .signals import add_administrator_on_project_creation diff --git a/backend/members/exceptions.py b/backend/projects/exceptions.py similarity index 100% rename from backend/members/exceptions.py rename to backend/projects/exceptions.py diff --git a/backend/members/management/__init__.py b/backend/projects/management/__init__.py similarity index 100% rename from backend/members/management/__init__.py rename to backend/projects/management/__init__.py diff --git a/backend/members/management/commands/__init__.py b/backend/projects/management/commands/__init__.py similarity index 100% rename from backend/members/management/commands/__init__.py rename to backend/projects/management/commands/__init__.py diff --git a/backend/members/management/commands/create_member.py b/backend/projects/management/commands/create_member.py similarity index 100% rename from backend/members/management/commands/create_member.py rename to backend/projects/management/commands/create_member.py diff --git a/backend/members/migrations/0001_initial.py b/backend/projects/migrations/0001_initial.py similarity index 72% rename from backend/members/migrations/0001_initial.py rename to backend/projects/migrations/0001_initial.py index c4bcccef..30b80953 100644 --- a/backend/members/migrations/0001_initial.py +++ b/backend/projects/migrations/0001_initial.py @@ -39,5 +39,17 @@ class Migration(migrations.Migration): ), ], database_operations=[] + ), + migrations.RunSQL( + sql="ALTER TABLE members_member RENAME TO projects_member", + reverse_sql="ALTER TABLE projects_member RENAME TO members_member" + ), + migrations.RunSQL( + sql="UPDATE django_content_type SET app_label='projects' WHERE app_label='members'", + reverse_sql="UPDATE django_content_type SET app_label='members' WHERE app_label='projects'" + ), + migrations.RunSQL( + sql="UPDATE django_migrations SET app='projects' WHERE app='members'", + reverse_sql="UPDATE django_migrations SET app='members' WHERE app='projects'" ) ] diff --git a/backend/members/migrations/__init__.py b/backend/projects/migrations/__init__.py similarity index 100% rename from backend/members/migrations/__init__.py rename to backend/projects/migrations/__init__.py diff --git a/backend/members/models.py b/backend/projects/models.py similarity index 100% rename from backend/members/models.py rename to backend/projects/models.py diff --git a/backend/members/permissions.py b/backend/projects/permissions.py similarity index 100% rename from backend/members/permissions.py rename to backend/projects/permissions.py diff --git a/backend/members/serializers.py b/backend/projects/serializers.py similarity index 100% rename from backend/members/serializers.py rename to backend/projects/serializers.py diff --git a/backend/members/signals.py b/backend/projects/signals.py similarity index 100% rename from backend/members/signals.py rename to backend/projects/signals.py diff --git a/backend/members/tests.py b/backend/projects/tests.py similarity index 99% rename from backend/members/tests.py rename to backend/projects/tests.py index 5e3682a8..73596067 100644 --- a/backend/members/tests.py +++ b/backend/projects/tests.py @@ -6,7 +6,7 @@ from rest_framework.reverse import reverse from model_mommy import mommy from roles.models import Role -from members.models import Member +from projects.models import Member from api.tests.api.utils import (CRUDMixin, prepare_project, make_user) diff --git a/backend/members/urls.py b/backend/projects/urls.py similarity index 100% rename from backend/members/urls.py rename to backend/projects/urls.py diff --git a/backend/members/views.py b/backend/projects/views.py similarity index 100% rename from backend/members/views.py rename to backend/projects/views.py diff --git a/backend/users/views.py b/backend/users/views.py index 26fc4bf3..ceb18b47 100644 --- a/backend/users/views.py +++ b/backend/users/views.py @@ -5,7 +5,7 @@ from rest_framework.permissions import IsAuthenticated from rest_framework.response import Response from rest_framework.views import APIView -from members.permissions import IsProjectAdmin +from projects.permissions import IsProjectAdmin from .serializers import UserSerializer