summaryrefslogtreecommitdiff
path: root/django/contrib
diff options
context:
space:
mode:
authorBrian Rosner <brosner@gmail.com>2008-07-18 20:23:02 +0000
committerBrian Rosner <brosner@gmail.com>2008-07-18 20:23:02 +0000
commitefc84a8a6348c9932a8a1bd14e7a30ba272df648 (patch)
treef9249ec82a520cb45cbcb973bc0fe5b1eb46dedb /django/contrib
parentdd5197f081b6f0cac77721f24563b05005a686fb (diff)
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
Diffstat (limited to 'django/contrib')
-rw-r--r--django/contrib/auth/models.py3
-rw-r--r--django/contrib/comments/admin.py29
-rw-r--r--django/contrib/comments/models.py34
-rw-r--r--django/contrib/flatpages/admin.py13
-rw-r--r--django/contrib/flatpages/models.py17
-rw-r--r--django/contrib/sites/admin.py8
-rw-r--r--django/contrib/sites/models.py12
7 files changed, 51 insertions, 65 deletions
diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py
index 83bdb95dab..a0ed4f366f 100644
--- a/django/contrib/auth/models.py
+++ b/django/contrib/auth/models.py
@@ -369,6 +369,3 @@ class AnonymousUser(object):
def is_authenticated(self):
return False
-
-# Register the admin options for these models.
-from django.contrib.auth import admin
diff --git a/django/contrib/comments/admin.py b/django/contrib/comments/admin.py
new file mode 100644
index 0000000000..67c5613a29
--- /dev/null
+++ b/django/contrib/comments/admin.py
@@ -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) \ No newline at end of file
diff --git a/django/contrib/comments/models.py b/django/contrib/comments/models.py
index f1a0bc5f48..a13fec9e6e 100644
--- a/django/contrib/comments/models.py
+++ b/django/contrib/comments/models.py
@@ -283,36 +283,4 @@ class ModeratorDeletion(models.Model):
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)
+ \ No newline at end of file
diff --git a/django/contrib/flatpages/admin.py b/django/contrib/flatpages/admin.py
new file mode 100644
index 0000000000..a3f7e9a824
--- /dev/null
+++ b/django/contrib/flatpages/admin.py
@@ -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) \ No newline at end of file
diff --git a/django/contrib/flatpages/models.py b/django/contrib/flatpages/models.py
index 11ccf43b02..466425cb46 100644
--- a/django/contrib/flatpages/models.py
+++ b/django/contrib/flatpages/models.py
@@ -26,20 +26,3 @@ class FlatPage(models.Model):
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)
diff --git a/django/contrib/sites/admin.py b/django/contrib/sites/admin.py
new file mode 100644
index 0000000000..bb5d0cab26
--- /dev/null
+++ b/django/contrib/sites/admin.py
@@ -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) \ No newline at end of file
diff --git a/django/contrib/sites/models.py b/django/contrib/sites/models.py
index 5f06333ae8..c44e5ce11f 100644
--- a/django/contrib/sites/models.py
+++ b/django/contrib/sites/models.py
@@ -49,18 +49,6 @@ class Site(models.Model):
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):
"""