I have an image model:
class Image(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey()
image = models.ImageField()
I also have a model that has fields
class MyModel(models.Model):
logo = models.ImageField()
icon = models.ImageField()
images = generic.GenericRelation(Image)
I want logou to iconalso use a common attitude Image. How can i do this?
In many models, I use a common model Image, so it should be a general relation. I just want to use the same model for all images, even if they are icons, profile images, or something else.
It would be best if Django had a field generic.GenericOneToOneRelation(Image)or something :-)
The only solution I can think of is
class MyModel(models.Model):
logo = models.ForeignKey(Image)
icon = models.ForeignKey(Image)
images = generic.GenericRelation(Image)
logo icon images logo icon images, images, . ?