veryacademy / django-ecommerce-project

The Django-Ecommerce is an open-source project initiative and tutorial series built with Python and the Django Framework.
MIT License
399 stars 278 forks source link

ERRORS: <class 'store.admin.CategoryAdmin'>: (admin.E029) The value of 'prepopulated_fields["slug"]' must be a list or tuple. #15

Open AAdewunmi opened 11 months ago

AAdewunmi commented 11 months ago

Hi,

Tried to create super user python manage.py createsuperuser and got the following error:

ERRORS:
<class 'store.admin.CategoryAdmin'>: (admin.E029) The value of 'prepopulated_fields["slug"]' must be a list or tuple.
<class 'store.admin.ProductAdmin'>: (admin.E029) The value of 'prepopulated_fields["slug"]' must be a list or tuple.

Here is a fix:

prepopulated_fields = {'slug': ('name,')}
prepopulated_fields = {'slug': ['name']}

prepopulated_fields = {'slug': ('title,')}
prepopulated_fields = {'slug': ['title']}

For an explanation on why you must use either a list or tuple, see Django Admin Documentation:

ModelAdmin.prepopulated_fields

😄