在我的网页上,我需要点击链接,将我带到大学名单列表....然后选择需要的名称,将我带到特定大学的可用部门列表中。然后通过选择一个部门,它需要带我到可用的血型列表...然后通过选择一个血型组,它需要带我到可用于特定血型的学生名单...... !!
这些应该以链式方式链接.. !!
我怎么能在模特的帮助下做到这一点...请给我一些建议朋友.. !!我是一个学习者.. !!
class CollegeName(models.Model):
name = models.CharField(max_length = 50)
def __str__(self):
return self.name
class Batch(models.Model):
batch = models.CharField(max_length=15)
college = models.OneToOneField(CollegeName,on_delete=models.CASCADE,related_name='batches',null=True)
def __str__(self):
return self.batch
class BloodGroup(models.Model):
blood = models.CharField(max_length=50)
batch_of_students = models.OneToOneField(Batch,on_delete=models.CASCADE,related_name='blood_group_list',null=True)
# college = models.ForeignKey(College_name,on_delete=models.CASCADE,related_name='college_name_via_blood_group',null=True)
def __str__(self):
return self.blood
类AddDonors(models.Model):
student_name = models.CharField(max_length = 264)
address = models.CharField(max_length=264)
blood_group = models.ForeignKey(BloodGroup,on_delete=models.CASCADE,related_name='donors',null=True)
mobile_number = models.CharField(max_length=10)
date_of_birth = models.DateField()
def __str__(self):
return self.student_name