mirror of
https://github.com/django/django.git
synced 2025-07-04 01:39:20 +00:00
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
This commit is contained in:
parent
dd5197f081
commit
efc84a8a63
@ -369,6 +369,3 @@ class AnonymousUser(object):
|
|||||||
|
|
||||||
def is_authenticated(self):
|
def is_authenticated(self):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Register the admin options for these models.
|
|
||||||
from django.contrib.auth import admin
|
|
||||||
|
29
django/contrib/comments/admin.py
Normal file
29
django/contrib/comments/admin.py
Normal file
@ -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)
|
@ -284,35 +284,3 @@ class ModeratorDeletion(models.Model):
|
|||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return _("Moderator deletion by %r") % self.user
|
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)
|
|
||||||
|
13
django/contrib/flatpages/admin.py
Normal file
13
django/contrib/flatpages/admin.py
Normal file
@ -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 @@ class FlatPage(models.Model):
|
|||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return self.url
|
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)
|
|
||||||
|
8
django/contrib/sites/admin.py
Normal file
8
django/contrib/sites/admin.py
Normal file
@ -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)
|
@ -50,18 +50,6 @@ class Site(models.Model):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
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):
|
class RequestSite(object):
|
||||||
"""
|
"""
|
||||||
A class that shares the primary interface of Site (i.e., it has
|
A class that shares the primary interface of Site (i.e., it has
|
||||||
|
Loading…
x
Reference in New Issue
Block a user