mirror of
https://github.com/HamzaSha1/zod-backend.git
synced 2025-07-15 18:07:02 +00:00
article card api, check answer api
This commit is contained in:
@ -112,7 +112,7 @@ MAX_ARTICLE_CARD = 6
|
||||
MIN_ARTICLE_SURVEY = 5
|
||||
MAX_ARTICLE_SURVEY = 10
|
||||
|
||||
# real time url
|
||||
time_url = "http://worldtimeapi.org/api/timezone/Asia/Riyadh"
|
||||
# already register
|
||||
Already_register_user = "duplicate key value violates unique constraint"
|
||||
|
||||
ARTICLE_CARD_IMAGE_FOLDER = 'article-card-images'
|
||||
|
@ -22,7 +22,7 @@ from account.models import UserProfile, UserEmailOtp, UserNotification
|
||||
from account.utils import generate_code
|
||||
from junior.serializers import JuniorDetailSerializer
|
||||
from base.messages import ERROR_CODE, SUCCESS_CODE
|
||||
from base.constants import NUMBER, JUN, ZOD, GRD
|
||||
from base.constants import NUMBER, JUN, ZOD, GRD, Already_register_user
|
||||
from junior.models import Junior, JuniorPoints, JuniorGuardianRelationship
|
||||
from .utils import real_time, convert_timedelta_into_datetime, update_referral_points
|
||||
# notification's constant
|
||||
|
@ -11,7 +11,7 @@ import tempfile
|
||||
# Import date time module's function
|
||||
from datetime import datetime, time
|
||||
# import Number constant
|
||||
from base.constants import NUMBER, time_url
|
||||
from base.constants import NUMBER
|
||||
# Import Junior's model
|
||||
from junior.models import Junior, JuniorPoints
|
||||
# Import guardian's model
|
||||
|
@ -10,7 +10,6 @@ from rest_framework.permissions import IsAuthenticated
|
||||
from rest_framework import viewsets, status
|
||||
from rest_framework.pagination import PageNumberPagination
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils import timezone
|
||||
|
||||
# Import guardian's model,
|
||||
# Import junior's model,
|
||||
@ -57,7 +56,6 @@ class SignupViewset(viewsets.ModelViewSet):
|
||||
serializer_class = UserSerializer
|
||||
def create(self, request, *args, **kwargs):
|
||||
"""Create user profile"""
|
||||
try:
|
||||
if request.data['user_type'] in [str(NUMBER['one']), str(NUMBER['two'])]:
|
||||
serializer = UserSerializer(context=request.data['user_type'], data=request.data)
|
||||
if serializer.is_valid():
|
||||
@ -78,8 +76,6 @@ class SignupViewset(viewsets.ModelViewSet):
|
||||
return custom_error_response(serializer.errors, response_status=status.HTTP_400_BAD_REQUEST)
|
||||
else:
|
||||
return custom_error_response(ERROR_CODE['2028'], response_status=status.HTTP_400_BAD_REQUEST)
|
||||
except Exception as e:
|
||||
return custom_error_response(str(e), response_status=status.HTTP_400_BAD_REQUEST)
|
||||
|
||||
class UpdateGuardianProfile(viewsets.ViewSet):
|
||||
"""Update guardian profile"""
|
||||
|
Reference in New Issue
Block a user