Created
August 14, 2008 19:51
-
-
Save opie4624/5474 to your computer and use it in GitHub Desktop.
Differences between old contrib.admin and new contrib.admin
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 django.contrib.flatpages.models import FlatPage | |
from cms.search.models import SearchKeyword | |
#class SearchKeywordAdmin(admin.ModelAdmin): | |
# """Provide the admin functions for the SearchKeyword model.""" | |
# pass | |
class SearchKeywordInline(admin.StackedInline): | |
model = SearchKeyword | |
class FlatPageAdmin(admin.ModelAdmin): | |
fieldsets = ( | |
(None, { | |
'fields': ('url', 'title', 'content', 'sites',) | |
}), | |
('Advanced options', { | |
'classes': ('collapse',), | |
'fields': ('enable_comments', 'registration_required', 'template_name',) | |
}) | |
) | |
inlines = [ | |
SearchKeywordInline, | |
] | |
admin.site.register(SearchKeyword, admin.ModelAdmin) | |
admin.site.unregister(FlatPage) | |
admin.site.register(FlatPage, FlatPageAdmin) |
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.db import models | |
from django.contrib.flatpages.models import FlatPage | |
class SearchKeyword(models.Model): | |
keyword = models.CharField(max_length=50, core=True) | |
page = models.ForeignKey(FlatPage) | |
def __unicode__(self): | |
return self.keyword | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment