admin.py 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. """ Newforms Admin configuration for Darkroom
  2. """
  3. from django.contrib import admin
  4. from models import *
  5. class MovieAdmin(admin.ModelAdmin):
  6. list_display = ('title', 'slug', 'created', 'published')
  7. list_filter = ['created', 'published']
  8. list_per_page = 10
  9. admin.site.register(Movie, MovieAdmin)
  10. class GalleryAdmin(admin.ModelAdmin):
  11. list_display = ('title', 'slug', 'created', 'photo_count', 'published')
  12. list_filter = ['created', 'published']
  13. date_hierarchy = 'created'
  14. filter_horizontal = ('towns','sites','photos',)
  15. class PhotographerAdmin(admin.ModelAdmin):
  16. list_display = ('name',)
  17. list_filter = ['created']
  18. list_per_page = 10
  19. class PhotoAdmin(admin.ModelAdmin):
  20. list_display = ('title', 'slug', 'created', 'published', 'view_count', 'admin_thumbnail')
  21. list_filter = ['created', 'published']
  22. list_per_page = 10
  23. search_fields=('title','description','photographer__name',)
  24. filter_horizontal = ('towns','sites',)
  25. fieldsets = (
  26. (None, {
  27. 'fields': ('title', 'slug','description', 'image', 'photographer', 'courtesy', 'file_photo')
  28. }),
  29. ('Publishing', {
  30. 'fields': ('weight', 'published', 'published_on', 'tags', 'towns', 'sites')
  31. }),
  32. ('Presentation', {
  33. 'fields': ('crop_from', 'effect', 'orientation')
  34. }),
  35. )
  36. class PhotoEffectAdmin(admin.ModelAdmin):
  37. list_display = ('name', 'description', 'admin_sample')
  38. fieldsets = (
  39. (None, {
  40. 'fields': ('name', 'description')
  41. }),
  42. ('Adjustments', {
  43. 'fields': ('color', 'brightness', 'contrast', 'sharpness')
  44. }),
  45. ('Filters', {
  46. 'fields': ('filters',)
  47. }),
  48. ('Reflection', {
  49. 'fields': ('reflection_size', 'reflection_strength', 'background_color')
  50. }),
  51. )
  52. class PhotoSizeAdmin(admin.ModelAdmin):
  53. list_display = ('name', 'width', 'height', 'crop', 'pre_cache', 'effect', 'increment_count')
  54. fieldsets = (
  55. (None, {
  56. 'fields': ('name', 'width', 'height', 'quality')
  57. }),
  58. ('Options', {
  59. 'fields': ('upscale', 'crop', 'pre_cache', 'increment_count')
  60. }),
  61. ('Enhancements', {
  62. 'fields': ('effect', 'watermark',)
  63. }),
  64. )
  65. class WatermarkAdmin(admin.ModelAdmin):
  66. list_display = ('name', 'opacity', 'style')
  67. class GraphicAdmin(admin.ModelAdmin):
  68. list_display = ('title', 'slug', 'created', 'published', 'view_count', 'admin_thumbnail')
  69. list_filter = ['created', 'published']
  70. list_per_page = 10
  71. admin.site.register(Graphic, GraphicAdmin)
  72. admin.site.register(Gallery, GalleryAdmin)
  73. admin.site.register(GalleryUpload)
  74. admin.site.register(Slideshow)
  75. admin.site.register(SlideshowUpload)
  76. admin.site.register(Photographer, PhotographerAdmin)
  77. admin.site.register(Photo, PhotoAdmin)
  78. admin.site.register(PhotoEffect, PhotoEffectAdmin)
  79. admin.site.register(PhotoSize, PhotoSizeAdmin)
  80. admin.site.register(Watermark, WatermarkAdmin)
  81. admin.site.register(Webcam)