| 1 |
from django.contrib import admin |
|---|
| 2 |
from django.contrib.comments.models import Comment, FreeComment |
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
class CommentAdmin(admin.ModelAdmin): |
|---|
| 6 |
fieldsets = ( |
|---|
| 7 |
(None, {'fields': ('content_type', 'object_id', 'site')}), |
|---|
| 8 |
('Content', {'fields': ('user', 'headline', 'comment')}), |
|---|
| 9 |
('Ratings', {'fields': ('rating1', 'rating2', 'rating3', 'rating4', 'rating5', 'rating6', 'rating7', 'rating8', 'valid_rating')}), |
|---|
| 10 |
('Meta', {'fields': ('is_public', 'is_removed', 'ip_address')}), |
|---|
| 11 |
) |
|---|
| 12 |
list_display = ('user', 'submit_date', 'content_type', 'get_content_object') |
|---|
| 13 |
list_filter = ('submit_date',) |
|---|
| 14 |
date_hierarchy = 'submit_date' |
|---|
| 15 |
search_fields = ('comment', 'user__username') |
|---|
| 16 |
raw_id_fields = ('user',) |
|---|
| 17 |
|
|---|
| 18 |
class FreeCommentAdmin(admin.ModelAdmin): |
|---|
| 19 |
fieldsets = ( |
|---|
| 20 |
(None, {'fields': ('content_type', 'object_id', 'site')}), |
|---|
| 21 |
('Content', {'fields': ('person_name', 'comment')}), |
|---|
| 22 |
('Meta', {'fields': ('is_public', 'ip_address', 'approved')}), |
|---|
| 23 |
) |
|---|
| 24 |
list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object') |
|---|
| 25 |
list_filter = ('submit_date',) |
|---|
| 26 |
date_hierarchy = 'submit_date' |
|---|
| 27 |
search_fields = ('comment', 'person_name') |
|---|
| 28 |
|
|---|
| 29 |
admin.site.register(Comment, CommentAdmin) |
|---|
| 30 |
admin.site.register(FreeComment, FreeCommentAdmin) |
|---|