简体   繁体   中英

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

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM