2
Then, this is a sign to have a separate model for building blocks:
class Material(models.Model):
name = models.CharField(max_length=12, null=False)
You Location
model would be related to the Material
model. In case location
can only have a single material
, it would be a ForeignKey
:
class Location(models.Model):
materials = models.ForeignKey(Material)
Source:stackexchange.com