Jun 272009

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.

Posted by weboom at 3:17 pm Tagged with:
Jun 272009

In admin interface
list_filter
provides an easy access.

——
e.g.,

list_filter = (’pub_date’, ‘enable_comments’)

Posted by weboom at 6:54 am Tagged with: ,
Jun 272009

In admin interface,
search_fields
indicates the area for search.

————
e.g.,

search_fields = (’title’, ’slug’, ‘body’)

Posted by weboom at 6:52 am Tagged with: ,
Jun 272009

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’)

Posted by weboom at 6:49 am Tagged with: ,
Jun 262009

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)

Posted by weboom at 10:42 pm Tagged with: , , ,
Jun 262009

from django.contrib import admin
otherwise,
django can’t understand
(r’^admin/(.*)’, admin.site.root),

Posted by weboom at 7:32 am Tagged with: , , ,
Switch to our mobile site
Top Footer