I am getting this error after writing a Custom Admin Model for the custom user I made. Here's 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 makemigrations
command , I get this error:
SystemCheckError: System check identified some issues: ERRORS: <class 'user.admin.MyUserAdmin'>: (admin.E008) The value of 'fieldsets[1]['fields']' must be a list or tuple.
You are missing a trailing comma in your 'Password Details' fieldset. It should be:
('Password Details',{'fields' : ('password',)}),)
^
| # this comma
Without the comma, ('password')
is the same as 'password'
, which is a string, not a tuple.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With