Author: brosner
Date: 2008-07-18 15:23:02 -0500 (Fri, 18 Jul 2008)
New Revision: 7953
Added:
django/branches/newforms-admin/django/contrib/comments/admin.py
django/branches/newforms-admin/django/contrib/flatpages/admin.py
django/branches/newforms-admin/django/contrib/sites/admin.py
Modified:
django/branches/newforms-admin/django/contrib/auth/models.py
django/branches/newforms-admin/django/contrib/comments/models.py
django/branches/newforms-admin/django/contrib/flatpages/models.py
django/branches/newforms-admin/django/contrib/sites/models.py
Log:
newforms-admin: Moved contrib ModelAdmin classes to an admin.py file in their
respective apps. This is allowed since [7872].
Modified: django/branches/newforms-admin/django/contrib/auth/models.py
===================================================================
--- django/branches/newforms-admin/django/contrib/auth/models.py
2008-07-18 19:45:00 UTC (rev 7952)
+++ django/branches/newforms-admin/django/contrib/auth/models.py
2008-07-18 20:23:02 UTC (rev 7953)
@@ -369,6 +369,3 @@
def is_authenticated(self):
return False
-
-# Register the admin options for these models.
-from django.contrib.auth import admin
Added: django/branches/newforms-admin/django/contrib/comments/admin.py
===================================================================
--- django/branches/newforms-admin/django/contrib/comments/admin.py
(rev 0)
+++ django/branches/newforms-admin/django/contrib/comments/admin.py
2008-07-18 20:23:02 UTC (rev 7953)
@@ -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
Modified: django/branches/newforms-admin/django/contrib/comments/models.py
===================================================================
--- django/branches/newforms-admin/django/contrib/comments/models.py
2008-07-18 19:45:00 UTC (rev 7952)
+++ django/branches/newforms-admin/django/contrib/comments/models.py
2008-07-18 20:23:02 UTC (rev 7953)
@@ -283,36 +283,4 @@
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
Added: django/branches/newforms-admin/django/contrib/flatpages/admin.py
===================================================================
--- django/branches/newforms-admin/django/contrib/flatpages/admin.py
(rev 0)
+++ django/branches/newforms-admin/django/contrib/flatpages/admin.py
2008-07-18 20:23:02 UTC (rev 7953)
@@ -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
Modified: django/branches/newforms-admin/django/contrib/flatpages/models.py
===================================================================
--- django/branches/newforms-admin/django/contrib/flatpages/models.py
2008-07-18 19:45:00 UTC (rev 7952)
+++ django/branches/newforms-admin/django/contrib/flatpages/models.py
2008-07-18 20:23:02 UTC (rev 7953)
@@ -26,20 +26,3 @@
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)
Added: django/branches/newforms-admin/django/contrib/sites/admin.py
===================================================================
--- django/branches/newforms-admin/django/contrib/sites/admin.py
(rev 0)
+++ django/branches/newforms-admin/django/contrib/sites/admin.py
2008-07-18 20:23:02 UTC (rev 7953)
@@ -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
Modified: django/branches/newforms-admin/django/contrib/sites/models.py
===================================================================
--- django/branches/newforms-admin/django/contrib/sites/models.py
2008-07-18 19:45:00 UTC (rev 7952)
+++ django/branches/newforms-admin/django/contrib/sites/models.py
2008-07-18 20:23:02 UTC (rev 7953)
@@ -49,19 +49,7 @@
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):
"""
A class that shares the primary interface of Site (i.e., it has
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---