User data not updating in admin panel and forms django

Question:

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

Asked By: xDololow

||

Answers:

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.

Answered By: Rohit Rahman
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.