models:
class DoctorProfile(AbstractBaseUser, PermissionsMixin):
id=models.AutoField(primary_key=True)
name = models.CharField(_('name'), max_length=50, blank=True)
mobile = models.CharField(_('mobile'), unique=True, max_length=10, blank=False)
# mobile= models.CharField(primary_key=True , max_length=10, validators=[RegexValidator(r'^d{1,10}$')])
# mobile= models.IntegerField(validators=[MinValueValidator(10),MaxValueValidator(10)])
email = models.EmailField(_('email address'), blank=True)
password = models.CharField(_('password'),max_length=25,blank=False)
date_joined = models.DateTimeField(_('date joined'), auto_now_add=True)
is_verified=models.BooleanField(default=False)
is_active = models.BooleanField(_('active'), default=False)
is_doctor = models.BooleanField(_('active'), default=False)
otp = models.IntegerField(null=True, blank=True)
dob=models.DateField()
GENDER_CHOICES = (
('M', 'Male'),
('F', 'Female'),
)
gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
How to Create custom permission for creating tasks ?
eg:
class ClinicRegistrationView(generics.ListCreateAPIView):
serializer_class = ClinicSerializer
queryset = Doctor_clinic.objects.all()
permission_classes = (permissions.IsAuthenticated,)#token user can create
How to give is_doctor permission ,only create task ??
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…