I have this Tables
class Category(models.Model):
name = models.CharField(max_length=20)
class Rule(models.Model):
category = models.ForeignKey(Category, on_delete=models.CASCADE)
next_page = models.ForeignKey(Category, on_delete=models.CASCADE, null=True)
# ... other fields
Obviously, I am no database or Django expert, the need for next_page
and category are different The Rule table is supposed to be used to set the page that comes next after certain condition are met/performed by the user. My general question is there a better way to do this?
CodePudding user response:
Yes, no problem, provided this usage is natural.
For example, an airline with a table of flight
s. Each flight
would completely naturally have a from
and a destination
both of which are ForeignKeys to Airport
objects.