I have
class BaseModelMixin(models.Model):
class Meta:
abstract = True
uuid = models.UUIDField(default=uuid4, editable=False, db_index=True)
created_on = models.DateTimeField(default=now, editable=False, blank=True)
updated_on = models.DateTimeField(default=now, editable=False, blank=True)
and
class Something(BaseModelMixin):
whatever = models.TextField(blank=True, null=True)
class SomethingElse(BaseModelMixin):
whoever = models.TextField(blank=True, null=True)
on the admin site, for each Something, I see whatever, but not uuid, created_on, or updated_on. I must be missing something obvious... it'd be surprising if the django admin didn't automatically show me these fields.
I definitely want the abstract; I don't want an additional table, I want the uuid, created_on, updated_on fields to be in the concrete class tables, and they are. They just don't show up in the django admin site.
What am I doing wrong?
Anoop's answers is partially correct:
class BaseModelMixinAdmin(admin.ModelAdmin):
readonly_fields=('uuid','created_on','updated_on')
but then also:
admin.site.register(Something, BaseModelMixinAdmin)
admin.site.register(SomethingElse, BaseModelMixinAdmin)
... which is a little irritating that I have to do this at all, but oh well, it ain't that bad...