xDololow
xDololow

Reputation: 29

User data not updating in admin panel and forms django

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

Upvotes: 0

Views: 143

Answers (1)

Rohit Rahman
Rohit Rahman

Reputation: 1153

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.

Upvotes: 1

Related Questions