1. (r’^admin/’, admin.site.root)
2. (r’^admin/(.*)’, admin.site.root)
If you type in browser
/admin/xx/ with 1, you will get the below error:
root() takes exactly 3 arguments (2 given)
So, use 2.
1. (r’^admin/’, admin.site.root)
2. (r’^admin/(.*)’, admin.site.root)
If you type in browser
/admin/xx/ with 1, you will get the below error:
root() takes exactly 3 arguments (2 given)
So, use 2.
In admin interface
list_filter
provides an easy access.
——
e.g.,
list_filter = (’pub_date’, ‘enable_comments’)
In admin interface,
search_fields
indicates the area for search.
————
e.g.,
search_fields = (’title’, ’slug’, ‘body’)
In admin interface,
the element of list will be displayed.
—————-
e.g.,
from django.contrib import admin
from mailer.models import Message
class MessageAdmin(admin.ModelAdmin):
list_display = (’id’, ‘to_address’, ’subject’, ‘when_added’, ‘priority’)
After you generate a model, if you register the model at admin site,
admin can create data based on your model design (even if you haven’t built the input page yet.)
————
e.g.,
from django.contrib import admin
from yourapp.models import Post
class PostAdmin(admin.ModelAdmin):
prepopulated_fields = {’slug’: (’title’,)}
admin.site.register(Post, PostAdmin)
from django.contrib import admin
otherwise,
django can’t understand
(r’^admin/(.*)’, admin.site.root),
