[Django]-How to fix "cannot unpack non-iterable NoneType object" error in django admin whilst using custom user model

12👍

Your add_fieldsets isn’t defined as a tuple/list itself, it’s just () around another tuple. So your code just sees (None, {}) as the tuple, whereas it’s expecting a tuple of tuples.

You need to either use square brackets or add a , after the only element of your list:

add_fieldsets = (
    (None, {
            'classes':('wide',),
            'fields':('name','username', 'email','phone','country','state','city','address','age','registration_date','password1','password2')
        }
    ),  # <-- add this comma!
)

or

add_fieldsets = [
    (None, {
            'classes':('wide',),
            'fields':('name','username', 'email','phone','country','state','city','address','age','registration_date','password1','password2')
        }
    )
]  # <-- list

Leave a comment