I have the following models:
class BaseModel(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
class Meta:
abstract = True
class Content(BaseModel):
title = models.CharField(max_length=2000)
class Document(Content):
file = models.FileField()
reading_time = models.IntegerField()
class DocumentView(BaseModel):
document = models.ForeignKey(Document, on_delete=models.CASCADE)
viewed_on = models.DateTimeField(auto_now=True)
Everything works as expected, except that in the Django Admin, editing a DocumentView model, the Document dropdown doesn't get selected with the saved Document.
Regarding the Admin, I use it in the default way:
admin.site.register(DocumentView)