Home > Blockchain >  User data not updating in admin panel and forms django
User data not updating in admin panel and forms django

Time:12-09

When I try to update user data (in admin panel or form) it does nothing and give 0 errors. In the admin panel, it says it updated, but data stays the same.

Here's my model.py: https://pastecode.io/s/jx4jpt0x

CodePudding user response:

The problem is here:

def save(self, *args, **kwargs):
    if not self.pk:
        self.user_role = self.base_role
        return super().save(*args, **kwargs)

You should not modify the save method since this is not required. You have already defined the user_role attribute with default value as base_role.

  • Related