admin.py 3.1 KB

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