[Django]-Fields Don't show in django admin

4πŸ‘

βœ…

The id is given by the database (it is the primary key) and the created_at and updated_at are items that are non-editable, so these will not show in the form either.

This thus means that role would be the only field that can be used, but you specified this as editable=False [Django-doc], hence it will not show up to create/edit a Role object.

You should remove the editable=False part:

class Role(Core):
    #                             no editable = False ↓
    role = models.CharField(max_length=25, unique=True)

    def save(self, *args, **kwargs):
        self.role = self.role.lower()
        super(Role, self).save(*args, **kwargs)

    def __str__(self):
        return self.role.capitalize()

Leave a comment