简体   繁体   中英

How to handle Django ModelForm for Many-to-Many fields

I had to show many to many fields on admin pages of both models that had a many to many relationship and I used this approach which worked perfectly.

I had to show a field of tags while adding/editing user. The field was added, but I lost the functionality of password hashing. So now, I've to use UserAdmin as suggested here

Actually, I'm trying this:

class CustomUserAdmin(UserAdmin):
    form = UserForm

which is not working with the existing form ie the tags field is not displayed at all. What I need to change?

Try to create inlines . Inlines let you show and customize related object in admin panel.

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