Updated requirements and added school id api endpoints
This commit is contained in:
parent
eb9fdade9b
commit
230cc431e9
@ -1,7 +1,33 @@
|
||||
asgiref==3.11.0
|
||||
attrs==25.4.0
|
||||
certifi==2025.11.12
|
||||
cffi==2.0.0
|
||||
charset-normalizer==3.4.4
|
||||
cryptography==46.0.3
|
||||
defusedxml==0.7.1
|
||||
Django==5.2.9
|
||||
django-cors-headers==4.9.0
|
||||
django-filter==25.2
|
||||
django-rest-framework==0.1.0
|
||||
djangorestframework==3.16.1
|
||||
djangorestframework_simplejwt==5.5.1
|
||||
drf-spectacular==0.29.0
|
||||
idna==3.11
|
||||
inflection==0.5.1
|
||||
jsonschema==4.25.1
|
||||
jsonschema-specifications==2025.9.1
|
||||
oauthlib==3.3.1
|
||||
pycparser==2.23
|
||||
PyJWT==2.10.1
|
||||
python-dotenv==1.2.1
|
||||
python3-openid==3.2.0
|
||||
PyYAML==6.0.3
|
||||
referencing==0.37.0
|
||||
requests==2.32.5
|
||||
requests-oauthlib==2.0.0
|
||||
rpds-py==0.30.0
|
||||
social-auth-app-django==5.6.0
|
||||
social-auth-core==4.8.1
|
||||
sqlparse==0.5.4
|
||||
uritemplate==4.2.0
|
||||
urllib3==2.5.0
|
||||
|
||||
@ -15,7 +15,7 @@ class User(AbstractUser):
|
||||
COMMON = 'common', 'Common'
|
||||
PROFESSOR = 'prof', 'Professor'
|
||||
|
||||
school_index = models.ForeignKey(SchoolID, on_delete=models.CASCADE)
|
||||
school_index = models.ForeignKey(SchoolID, on_delete=models.PROTECT)
|
||||
role = models.CharField(max_length=20, choices=Roles, default=Roles.COMMON)
|
||||
|
||||
@staticmethod
|
||||
|
||||
@ -14,4 +14,9 @@ urlpatterns = [
|
||||
path('<int:pk>/', UserAPIView.as_view()),
|
||||
path('', UserListAPIView.as_view())
|
||||
])),
|
||||
|
||||
path('schools/', include([
|
||||
path('<int:pk>/', SchoolAPIView.as_view()),
|
||||
path('', SchoolListAPIView.as_view())
|
||||
])),
|
||||
]
|
||||
|
||||
@ -12,8 +12,8 @@ from rest_framework.authtoken.models import Token
|
||||
from drf_spectacular.utils import extend_schema
|
||||
|
||||
from project.serializers import MessageResponseSerializer
|
||||
from .models import User
|
||||
from .serializers import UserSerializer, LoginSerializer, RegisterSerializer, TokenSerializer, UserForAdminSerializer
|
||||
from .models import User, SchoolID
|
||||
from .serializers import UserSerializer, LoginSerializer, RegisterSerializer, TokenSerializer, UserForAdminSerializer, SchoolIDSerializer
|
||||
|
||||
# Create your views here.
|
||||
|
||||
@ -85,4 +85,18 @@ class UserListAPIView(ListAPIView):
|
||||
class UserAPIView(RetrieveUpdateDestroyAPIView):
|
||||
queryset = User.objects.all()
|
||||
serializer_class = UserForAdminSerializer
|
||||
permission_classes = [IsAdminUser]
|
||||
|
||||
@extend_schema(tags=['Users'],
|
||||
description='List of all available school ids')
|
||||
class SchoolListAPIView(ListAPIView):
|
||||
queryset = SchoolID.objects.all()
|
||||
serializer_class = SchoolIDSerializer
|
||||
permission_classes = [IsAdminUser]
|
||||
|
||||
@extend_schema(tags=['Users'],
|
||||
description='CRUD for specific school id')
|
||||
class SchoolAPIView(RetrieveUpdateDestroyAPIView):
|
||||
queryset = SchoolID.objects.all()
|
||||
serializer_class = SchoolIDSerializer
|
||||
permission_classes = [IsAdminUser]
|
||||
Loading…
x
Reference in New Issue
Block a user