| 286 | | |
|---|
| 287 | | # Register the admin options for these models. |
|---|
| 288 | | # TODO: Maybe this should live in a separate module admin.py, but how would we |
|---|
| 289 | | # ensure that module was loaded? |
|---|
| 290 | | |
|---|
| 291 | | from django.contrib import admin |
|---|
| 292 | | |
|---|
| 293 | | class CommentAdmin(admin.ModelAdmin): |
|---|
| 294 | | fieldsets = ( |
|---|
| 295 | | (None, {'fields': ('content_type', 'object_id', 'site')}), |
|---|
| 296 | | ('Content', {'fields': ('user', 'headline', 'comment')}), |
|---|
| 297 | | ('Ratings', {'fields': ('rating1', 'rating2', 'rating3', 'rating4', 'rating5', 'rating6', 'rating7', 'rating8', 'valid_rating')}), |
|---|
| 298 | | ('Meta', {'fields': ('is_public', 'is_removed', 'ip_address')}), |
|---|
| 299 | | ) |
|---|
| 300 | | list_display = ('user', 'submit_date', 'content_type', 'get_content_object') |
|---|
| 301 | | list_filter = ('submit_date',) |
|---|
| 302 | | date_hierarchy = 'submit_date' |
|---|
| 303 | | search_fields = ('comment', 'user__username') |
|---|
| 304 | | raw_id_fields = ('user',) |
|---|
| 305 | | |
|---|
| 306 | | class FreeCommentAdmin(admin.ModelAdmin): |
|---|
| 307 | | fieldsets = ( |
|---|
| 308 | | (None, {'fields': ('content_type', 'object_id', 'site')}), |
|---|
| 309 | | ('Content', {'fields': ('person_name', 'comment')}), |
|---|
| 310 | | ('Meta', {'fields': ('is_public', 'ip_address', 'approved')}), |
|---|
| 311 | | ) |
|---|
| 312 | | list_display = ('person_name', 'submit_date', 'content_type', 'get_content_object') |
|---|
| 313 | | list_filter = ('submit_date',) |
|---|
| 314 | | date_hierarchy = 'submit_date' |
|---|
| 315 | | search_fields = ('comment', 'person_name') |
|---|
| 316 | | |
|---|
| 317 | | admin.site.register(Comment, CommentAdmin) |
|---|
| 318 | | admin.site.register(FreeComment, FreeCommentAdmin) |
|---|
| | 286 | |
|---|