I’m currently on the 2nd Django Tutorial by Hacked Existence on youtube. It is helping me to learn and I would like to continue to do so. I understand that the video is posted about a year ago so it’s a little out of date. So I have some questions.
I created an app called beers
python manage.py sqlall beer
In minute 13, he edits admin.py as such:
from django.contrib import admin
from beer.models import Beer, Brewery
class BeerAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('name')}
admin.site.register(Beer, BeerAdmin)
admin.site.register(Brewery)
This modification leads to an error:
ImproperlyConfigured at /admin/
‘BeerAdmin.prepopulated_fields[‘slug’]’ must be a list or tuple.
How do I fix this problem, and why did this same code work fine for his system.
This message is displayed at
http://127.0.0.1:8000/admin/
which leads to the next question,
On my browser,
HackedExistence link
opens up the Apache 2 Test Page
and the localhost link opens up the Django Administrator page nicely (well, it did until the above edit).
But he sets it up so that hacked existence link loads up the Django Admin page.
I have no problem with my setup if it does not lead to further issues. But I would like to know what different steps are needed for setting it up that way with the versions that I’m working with.
Python 2.7.3, Django 1.4.1, Apache 2.2.22 (Unix)
I’m working with OS X 10.6.8.
Change your definition to
Note: the comma after
'name', without the comm its interpreted as string object not a tuple or list.