Commit 7c509208 authored by Florent Chehab's avatar Florent Chehab
Browse files

Merge branch 'new_file_orga' into 'master'

New repo organization

Closes #38

See merge request !42
parents 818af843 f794902c
Pipeline #34760 failed with stages
in 2 minutes and 40 seconds
from django.db import models
from backend.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend.models.university import University
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.abstract.taggedItem import TaggedItem, TaggedItemSerializer, TaggedItemViewSet
from backend_app.models.university import University
from backend_app.utils import get_model_config, get_viewset_permissions
class UniversityTaggedItem(TaggedItem):
......
from django.db import models
from backend.models.other_core.specialty import Specialty
from backend.models.other_core.semester import Semester
from backend.models.university import University
from backend_app.models.other_core.specialty import Specialty
from backend_app.models.other_core.semester import Semester
from backend_app.models.university import University
from django.contrib.auth.models import User
from backend.fields import JSONField
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.fields import JSONField
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class PreviousDeparture(MyModel):
......
from django.db import models
from django.core.validators import MaxValueValidator
from backend.models.user import UserRestrictedModule, UserRestrictedModuleSerializer, UserRestrictedModuleViewSet
from backend.models.user import PreviousDeparture
from backend.fields import JSONField
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.user import UserRestrictedModule, UserRestrictedModuleSerializer, UserRestrictedModuleViewSet
from backend_app.models.user import PreviousDeparture
from backend_app.fields import JSONField
from backend_app.utils import get_model_config, get_viewset_permissions
class PreviousDepartureFeedback(UserRestrictedModule):
......
from django.db import models
from django.core.validators import MaxValueValidator
from backend.models.university import University
from backend.models.user import UserRestrictedModule, UserRestrictedModuleSerializer, UserRestrictedModuleViewSet
from backend.models.other_core import Specialty
from backend_app.models.university import University
from backend_app.models.user import UserRestrictedModule, UserRestrictedModuleSerializer, UserRestrictedModuleViewSet
from backend_app.models.other_core import Specialty
from backend.models.user import RecommendationList
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.user import RecommendationList
from backend_app.utils import get_model_config, get_viewset_permissions
class Recommendation(UserRestrictedModule):
......
from django.db import models
from backend.models.user import UserRestrictedModule, UserRestrictedModuleSerializer, UserRestrictedModuleViewSet
from backend.utils import get_model_config, get_viewset_permissions
from backend_app.models.user import UserRestrictedModule, UserRestrictedModuleSerializer, UserRestrictedModuleViewSet
from backend_app.utils import get_model_config, get_viewset_permissions
class RecommendationList(UserRestrictedModule):
......
from django.db import models
from rest_framework import serializers
from backend.models.university import University
from backend.fields import JSONField
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.models.university import University
from backend_app.fields import JSONField
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from django.contrib.auth.models import User
from backend.utils import get_viewset_permissions, get_model_config, get_user_level
from backend.permissions.__list_user_post_permission import list_user_post_permission
from backend_app.utils import get_viewset_permissions, get_model_config, get_user_level
from backend_app.permissions.__list_user_post_permission import list_user_post_permission
class UserData(MyModel):
......@@ -51,4 +51,10 @@ class UserDataViewSet(MyModelViewSet):
LIST_SHOULD_BE_DETAIL = True
def get_queryset(self):
return UserData.objects.filter(owner=self.request.user) # pylint: disable=E1101
def get_for_querier():
return UserData.objects.filter(owner=self.request.user) # pylint: disable=E1101
queryset = get_for_querier()
if len(queryset) == 0:
UserData.objects.update_or_create(owner=self.request.user)
queryset = get_for_querier()
return queryset
from django.db import models
from rest_framework import serializers
from django.contrib.auth.models import User
from backend.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
from backend_app.models.abstract.my_model import MyModel, MyModelSerializer, MyModelViewSet
class UserRestrictedModule(MyModel):
......
from backend.utils.__get_user_level import get_user_level
from backend_app.utils.__get_user_level import get_user_level
from django.conf import settings
from shared import OBJ_MODERATION_PERMISSIONS
......
......@@ -12,7 +12,7 @@ for model in api_config:
model = DotMap(model)
if not model.requires_testing:
if model.viewset != 'UserDataViewSet':
module = importlib.import_module("backend.models.{}".format (model.import_location))
module = importlib.import_module("backend_app.models.{}".format(model.import_location))
ALL_VIEWSETS[model.viewset] = getattr(module, model.viewset)
if settings.TESTING:
......@@ -20,7 +20,7 @@ if settings.TESTING:
model = DotMap(model)
if model.requires_testing:
if model.viewset != 'UserDataViewSet':
module = importlib.import_module("backend.models.{}".format (model.import_location))
module = importlib.import_module("backend_app.models.{}".format(model.import_location))
ALL_VIEWSETS[model.viewset] = getattr(module, model.viewset)
......
from backend.permissions import NoDeleteIfNotStaff
from backend_app.permissions import NoDeleteIfNotStaff
from rest_framework.permissions import IsAuthenticated
DEFAULT_VIEWSET_PERMISSIONS = (IsAuthenticated, NoDeleteIfNotStaff,)
from rest_framework import permissions
from backend.utils import is_member
from backend_app.utils import is_member
class IsDriOrNoPost(permissions.BasePermission):
......
from rest_framework import permissions
from backend.utils import is_member
from backend_app.utils import is_member
class IsDriOrReadOnly(permissions.BasePermission):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment