So,i am making an app for making timetables. and i have run into a problem. I have two models . Timetable and Content.
class Timetable(models.Model):
title=models.CharField(max_length=50)
start_time=models.TimeField(default="8:0")
end_time=models.TimeField(default="4:0")
entries=models.IntegerField(default=3)
theme=models.ForeignKey(Theme,on_delete=models.CASCADE,null=True)
def __str__(self):
return self.title
def get_absoulte_url(self):
return reverse('timetable-detail',args=[str(self.id)])
class CellEntry(models.Model):
parent_table=models.ForeignKey(Timetable,on_delete=models.CASCADE)
content=models.CharField(max_length=30)
def __str__(self):
return self.content
How can i make a form such that i can get the two models to behave like a table in excel? How can i set the value of multiple cellentry's parent_table attribute to be the same value in a view?
Aucun commentaire:
Enregistrer un commentaire