[Answer]-Present different models grouped using 2 common fields

1👍

You can model Image as a Concrete Base Class

class Image(models.Model):
    date = models.DateTime()
    stage = models.CharField(choices=STAGE, max_length=20)
    image = models.ImageField(...)


class Xray(Image):
    desc = models.CharField(choices=XRAY, max_length=15)


....

Then you can query all three kinds of Image objects using normal syntax like:

Image.objects.filter(date=datetime.date(2014, 1, 3), stage='Initial') 
👤arocks

Leave a comment