Django admin error admin.E008 Field field value must be a list or tuple

I am getting this error after writing a custom admin model for a custom user I created. Here is the code for User Admin:

class MyUserAdmin(UserAdmin):
    form = UserChangeForm
    add_form=UserCreationForm

    fieldsets = (
        ('Personal Details', {
           'fields': (
               'emp_id',
               ('emp_first_name', 'emp_last_name'),
               ('emp_gender', 'emp_dob', 'emp_marital_status'),
               ('emp_current_add','emp_permanent_add'), 
               ('emp_email_id', 'emp_mobile'),
               'emp_interests'
           )}),
        ('Company Details', {
            'fields': (
                'emp_designation',
                'emp_expertise', 
                ('emp_desk_ph', 'emp_pcname', 'emp_current_location'),
                ('emp_comp_join_date', 'emp_account_join_date'),             
                ('emp_farewell_date', 'emp_company_termination_date', 'emp_account_termination_date', 'emp_relocation_date'),
                'is_active'
            )}),
        ('Permission', {
            'fields': (
                ('is_superuser','is_staff','is_admin'),
                'groups'
            )}),
        ('Password Details',{'fields' : ('password')}),)

      

After running the makemigrations command, I get this error:

SystemCheckError: The system check revealed some problems:

ERRORS :: (admin.E008) The value 'fieldsets [1] [' fields ']' must be a list or a tuple.

Please help me with this. Spent a lot of time on this one. thanks in advance

+3


source to share


1 answer


You are missing a trailing comma in the Password Information field. It should be:

        ('Password Details',{'fields' : ('password',)}),)

      



No comma ('password')

matches 'password'

, which is a string, not a tuple.

+4


source







All Articles