|
|
@ -13,6 +13,7 @@ from .serializers import ( |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
from rest_framework.authentication import TokenAuthentication |
|
|
from rest_framework.authentication import TokenAuthentication |
|
|
|
|
|
from rest_framework.permissions import IsAuthenticated |
|
|
from apps.account.permissions import IsSuperAdmin |
|
|
from apps.account.permissions import IsSuperAdmin |
|
|
|
|
|
|
|
|
class AboutUsAPIView(GenericAPIView): |
|
|
class AboutUsAPIView(GenericAPIView): |
|
|
@ -49,6 +50,12 @@ class FAQCourseAPIView(GenericAPIView): |
|
|
|
|
|
|
|
|
class FAQGeneralAPIView(GenericAPIView): |
|
|
class FAQGeneralAPIView(GenericAPIView): |
|
|
serializer_class = FAQItemSerializer |
|
|
serializer_class = FAQItemSerializer |
|
|
|
|
|
authentication_classes = [TokenAuthentication] |
|
|
|
|
|
|
|
|
|
|
|
def get_permissions(self): |
|
|
|
|
|
if self.request.method in ['PUT', 'POST', 'PATCH']: |
|
|
|
|
|
return [IsAuthenticated(), IsSuperAdmin()] |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
def get(self, request, *args, **kwargs): |
|
|
preferences = global_preferences_registry.manager() |
|
|
preferences = global_preferences_registry.manager() |
|
|
@ -56,6 +63,13 @@ class FAQGeneralAPIView(GenericAPIView): |
|
|
serializer = self.get_serializer(faq_general, many=True) |
|
|
serializer = self.get_serializer(faq_general, many=True) |
|
|
return Response(serializer.data) |
|
|
return Response(serializer.data) |
|
|
|
|
|
|
|
|
|
|
|
def put(self, request, *args, **kwargs): |
|
|
|
|
|
serializer = self.get_serializer(data=request.data, many=True) |
|
|
|
|
|
serializer.is_valid(raise_exception=True) |
|
|
|
|
|
preferences = global_preferences_registry.manager() |
|
|
|
|
|
preferences['FAQ_General__FAQ_General'] = serializer.validated_data |
|
|
|
|
|
return Response(serializer.data) |
|
|
|
|
|
|
|
|
class SupportAPIView(GenericAPIView): |
|
|
class SupportAPIView(GenericAPIView): |
|
|
serializer_class = SupportSerializer |
|
|
serializer_class = SupportSerializer |
|
|
authentication_classes = [TokenAuthentication] |
|
|
authentication_classes = [TokenAuthentication] |
|
|
@ -106,6 +120,12 @@ class CardAPIView(GenericAPIView): |
|
|
|
|
|
|
|
|
class AboutUsDobodiAPIView(GenericAPIView): |
|
|
class AboutUsDobodiAPIView(GenericAPIView): |
|
|
serializer_class = AboutUsDobodiSerializer |
|
|
serializer_class = AboutUsDobodiSerializer |
|
|
|
|
|
authentication_classes = [TokenAuthentication] |
|
|
|
|
|
|
|
|
|
|
|
def get_permissions(self): |
|
|
|
|
|
if self.request.method in ['PUT', 'POST', 'PATCH']: |
|
|
|
|
|
return [IsAuthenticated(), IsSuperAdmin()] |
|
|
|
|
|
return [] |
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
def get(self, request, *args, **kwargs): |
|
|
preferences = global_preferences_registry.manager() |
|
|
preferences = global_preferences_registry.manager() |
|
|
@ -114,6 +134,13 @@ class AboutUsDobodiAPIView(GenericAPIView): |
|
|
about_us_dobodi = {} |
|
|
about_us_dobodi = {} |
|
|
serializer = self.get_serializer(about_us_dobodi) |
|
|
serializer = self.get_serializer(about_us_dobodi) |
|
|
return Response(serializer.data) |
|
|
return Response(serializer.data) |
|
|
|
|
|
|
|
|
|
|
|
def put(self, request, *args, **kwargs): |
|
|
|
|
|
serializer = self.get_serializer(data=request.data) |
|
|
|
|
|
serializer.is_valid(raise_exception=True) |
|
|
|
|
|
preferences = global_preferences_registry.manager() |
|
|
|
|
|
preferences['about_us_dobodi__about_us_dobodi'] = serializer.validated_data |
|
|
|
|
|
return Response(serializer.data) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""Todo : remove these views and use only context processors""" |
|
|
"""Todo : remove these views and use only context processors""" |
|
|
|