So I am a bit stuck right now.I know about django user model and what means to extend it..kinda. The thing is that I don't know how to get started... I have a student model where name, surname and student ID are entered in by the admin. Fields of email, phone and photo, are readonly. I want that a student can make an account, where he can enter all those fields himself, but name, surname and student ID need to match with those from database, otherwise he cannot make account. What is a good approach ?
class Student(models.Model): name = models.CharField(max_length=50) surname = models.CharField(max_length=50) student_ID = models.CharField(unique=True, max_length=14, validators=[RegexValidator(regex='^.{14}$', message='The ID needs to be 14 characters long.')]) photo = models.ImageField(upload_to='students_images') email = models.EmailField() phone = models.CharField(max_length=15, ) def __str__(self): return self.name + self.surname
This is how I started.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.