Created
February 15, 2014 10:55
-
-
Save dead23angel/9017632 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from blog.models import Post, Category | |
class BlogAdmin(admin.ModelAdmin): | |
exclude = ['posted'] | |
prepopulated_fields = {'slug': ('title',)} | |
fieldsets = [ | |
(None, {'fields': ['title',]}), | |
(None, {'fields': ['slug']}), | |
(None, {'fields': ['category']}), | |
(None, {'fields': ['tags']}), | |
('Date information', {'fields': ['datetime'], 'classes': ['collapse']}), | |
(None, {'fields': ['content']}), | |
] | |
class CategoryAdmin(admin.ModelAdmin): | |
prepopulated_fields = {'slug': ('title',)} | |
admin.site.register(Post, BlogAdmin) | |
admin.site.register(Category, CategoryAdmin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment