For example, if you take models:
class Region(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=256)
class Company(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=256)
region = models.ForeignKey('Region', db_index=True)
class Staff(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=256)
company = models.ForeignKey('Company', db_index=True)
I know that I do not need to include an identifier in these models, but I did this to make it more clear.
In this example, sometimes you just need to return a list of regions. At other times, you would like to return a list of regions with a list of all regional companies in each region.
You also, I believe, would like to receive even more detailed information about where you have a list of regions, their subsidiaries and the children of each employee.
What is the best way to handle these different levels of depth / detail with respect to the frame representations of the rest. How do people usually deal with this?
, , , , , ?