예제 #1
0
 def post(self, request, *args, **kwargs):
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     user = serializer.save()
     return Response({
         "Patient":
         UserAuthSerializer(user,
                            context=self.get_serializer_context()).data
     })
예제 #2
0
 def post(self, request, *args, **kwargs):
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     user = serializer.save()
     pat_info = patient_info.objects.get(user=user)
     self.send_mails(pat_info, request.data['password'])
     return Response({
         "Patient":
         UserAuthSerializer(user,
                            context=self.get_serializer_context()).data
     })
예제 #3
0
    def post(self, request, *args, **kwargs):
        serializer = self.get_serializer(data=request.data)
        serializer.is_valid(raise_exception=True)
        user = serializer.save()

        self.send_mails(doctors_info.objects.get(user=user))
        return Response({
            "Doctor":
            UserAuthSerializer(user,
                               context=self.get_serializer_context()).data
        })
예제 #4
0
 def post(self, request, *args, **kwargs):
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     user = serializer.save(loggedInuser=self.request.user.id)
     print(user)
     return Response({
         "Patient":
         UserAuthSerializer(user,
                            context=self.get_serializer_context()).data,
         "token":
         AuthToken.objects.create(user)[1]
     })
예제 #5
0
 def post(self, request, *args, **kwargs):
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     user = serializer.save()
     AuthToken.objects.filter(user__id=user.id).delete()
     login(request, user)
     return Response({
         'Patient':
         UserAuthSerializer(user,
                            context=self.get_serializer_context()).data,
         "token":
         AuthToken.objects.create(user)[1]
     })
예제 #6
0
 def post(self, request, *args, **kwargs):
     serializer = self.get_serializer(data=request.data)
     serializer.is_valid(raise_exception=True)
     input_username = request.data['username']
     user = User.objects.get(username=input_username)
     user = serializer.save(loggedInuser=user.id)
     print(user)
     self.send_mails(doctors_info.objects.get(user=user))
     return Response({
         "Doctor":
         UserAuthSerializer(user,
                            context=self.get_serializer_context()).data,
     })
예제 #7
0
class getAllConsultationsSerializer(serializers.ModelSerializer):
    doctor_id = doctors_infoSerializer()
    patient = UserAuthSerializer()
    patient_pic = serializers.SerializerMethodField('get_patient_pic')

    def get_patient_pic(self, obj):
        pat_details = patient_info.objects.get(user__id=obj.patient.id)
        if pat_details.profile_pic:
            return self.context['request'].build_absolute_uri(pat_details.profile_pic.url)
        return ""

    class Meta:
        model = consultations
        fields = ('id','doctor_id','patient','patient_name','patient_age','patient_gender','patient_pic','consultation_date_time','message')
예제 #8
0
class appointmentsListSerializer(serializers.ModelSerializer):
    doctor = doctors_infoSerializer()
    patient = UserAuthSerializer()
    patient_pic = serializers.SerializerMethodField('get_patient_pic')

    def get_patient_pic(self, obj):
        pat_details = patient_info.objects.get(user__id=obj.patient.id)
        if pat_details.profile_pic:
            return self.context['request'].build_absolute_uri(
                pat_details.profile_pic.url)
        return ""

    class Meta:
        model = appointment
        fields = ('id', 'doctor', 'patient', 'patient_name', 'patient_age',
                  'patient_gender', 'patient_pic', 'appointment_date',
                  'appointment_time', 'Description')
예제 #9
0
class appointmentsListSerializer(serializers.ModelSerializer):
    doctor = doctors_infoSerializer()
    patient = UserAuthSerializer()

    # patient_pic = serializers.SerializerMethodField('get_patient_pic')

    # def get_patient_pic(self, obj):
    #     pat_details = patient_info.objects.get(user=obj.patient)
    #     if pat_details.profile_pic:
    #         return self.context['request'].build_absolute_uri(pat_details.profile_pic.url)
    #     return ""

    class Meta:
        model = appointment
        fields = ('id', 'doctor', 'patient', 'paid_amount', 'patient_name',
                  'patient_age', 'patient_gender', 'appointment_date',
                  'appointment_time', 'Description', 'pat_id',
                  'patient_login_status', "video_flag")
예제 #10
0
class doctors_listSerializer(serializers.ModelSerializer):
    user = UserAuthSerializer()

    class Meta:
        model = doctors_info
        fields = '__all__'