Permalink
Browse files

newforms-admin: Moved contrib ModelAdmin classes to an admin.py file …

…in their respective apps. This is allowed since [7872].

git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@7953 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
1 parent dd5197f commit efc84a8a6348c9932a8a1bd14e7a30ba272df648 @brosner brosner committed Jul 18, 2008
@@ -369,6 +369,3 @@ def is_anonymous(self):
def is_authenticated(self):
return False
-
-# Register the admin options for these models.
-from django.contrib.auth import admin
@@ -0,0 +1,29 @@
+
+from django.contrib import admin
+
+class CommentAdmin(admin.ModelAdmin):
+ fieldsets = (
+ (None, {'fields': ('content_type', 'object_id', 'site')}),
+ ('Content', {'fields': ('user', 'headline', 'comment')}),
+ ('Ratings', {'fields': ('rating1', 'rating2', 'rating3', 'rating4', 'rating5', 'rating6', 'rating7', 'rating8', 'valid_rating')}),
+ ('Meta', {'fields': ('is_public', 'is_removed', 'ip_address')}),
+ )
+ list_display = ('user', 'submit_date', 'content_type', 'get_content_object')
+ list_filter = ('submit_date',)
+ date_hierarchy = 'submit_date'
+ search_fields = ('comment', 'user__username')
+ raw_id_fields = ('user',)
+
+class FreeCommentAdmin(admin.ModelAdmin):
+ fieldsets = (
+ (None, {'fields': ('content_type', 'object_id', 'site')}),
+ ('Content', {'fields': ('person_name', 'comment')}),
+ ('Meta', {'fields': ('is_public', 'ip_address', 'approved')}),
+ )
+ list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object')
+ list_filter = ('submit_date',)
+ date_hierarchy = 'submit_date'
+ search_fields = ('comment', 'person_name')
+
+admin.site.register(Comment, CommentAdmin)
+admin.site.register(FreeComment, FreeCommentAdmin)
@@ -283,36 +283,4 @@ class Meta:
def __unicode__(self):
return _("Moderator deletion by %r") % self.user
-
-# Register the admin options for these models.
-# TODO: Maybe this should live in a separate module admin.py, but how would we
-# ensure that module was loaded?
-
-from django.contrib import admin
-
-class CommentAdmin(admin.ModelAdmin):
- fieldsets = (
- (None, {'fields': ('content_type', 'object_id', 'site')}),
- ('Content', {'fields': ('user', 'headline', 'comment')}),
- ('Ratings', {'fields': ('rating1', 'rating2', 'rating3', 'rating4', 'rating5', 'rating6', 'rating7', 'rating8', 'valid_rating')}),
- ('Meta', {'fields': ('is_public', 'is_removed', 'ip_address')}),
- )
- list_display = ('user', 'submit_date', 'content_type', 'get_content_object')
- list_filter = ('submit_date',)
- date_hierarchy = 'submit_date'
- search_fields = ('comment', 'user__username')
- raw_id_fields = ('user',)
-
-class FreeCommentAdmin(admin.ModelAdmin):
- fieldsets = (
- (None, {'fields': ('content_type', 'object_id', 'site')}),
- ('Content', {'fields': ('person_name', 'comment')}),
- ('Meta', {'fields': ('is_public', 'ip_address', 'approved')}),
- )
- list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object')
- list_filter = ('submit_date',)
- date_hierarchy = 'submit_date'
- search_fields = ('comment', 'person_name')
-
-admin.site.register(Comment, CommentAdmin)
-admin.site.register(FreeComment, FreeCommentAdmin)
+
@@ -0,0 +1,13 @@
+
+from django.contrib import admin
+
+class FlatPageAdmin(admin.ModelAdmin):
+ fieldsets = (
+ (None, {'fields': ('url', 'title', 'content', 'sites')}),
+ (_('Advanced options'), {'classes': ('collapse',), 'fields': ('enable_comments', 'registration_required', 'template_name')}),
+ )
+ list_display = ('url', 'title')
+ list_filter = ('sites', 'enable_comments', 'registration_required')
+ search_fields = ('url', 'title')
+
+admin.site.register(FlatPage, FlatPageAdmin)
@@ -26,20 +26,3 @@ def __unicode__(self):
def get_absolute_url(self):
return self.url
-
-# Register the admin options for these models.
-# TODO: Maybe this should live in a separate module admin.py, but how would we
-# ensure that module was loaded?
-
-from django.contrib import admin
-
-class FlatPageAdmin(admin.ModelAdmin):
- fieldsets = (
- (None, {'fields': ('url', 'title', 'content', 'sites')}),
- (_('Advanced options'), {'classes': ('collapse',), 'fields': ('enable_comments', 'registration_required', 'template_name')}),
- )
- list_display = ('url', 'title')
- list_filter = ('sites', 'enable_comments', 'registration_required')
- search_fields = ('url', 'title')
-
-admin.site.register(FlatPage, FlatPageAdmin)
@@ -0,0 +1,8 @@
+
+from django.contrib import admin
+
+class SiteAdmin(admin.ModelAdmin):
+ list_display = ('domain', 'name')
+ search_fields = ('domain', 'name')
+
+admin.site.register(Site, SiteAdmin)
@@ -49,18 +49,6 @@ def delete(self):
del(SITE_CACHE[pk])
except KeyError:
pass
-
-# Register the admin options for these models.
-# TODO: Maybe this should live in a separate module admin.py, but how would we
-# ensure that module was loaded?
-
-from django.contrib import admin
-
-class SiteAdmin(admin.ModelAdmin):
- list_display = ('domain', 'name')
- search_fields = ('domain', 'name')
-
-admin.site.register(Site, SiteAdmin)
class RequestSite(object):
"""

0 comments on commit efc84a8

Please sign in to comment.