123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- """ Newforms Admin configuration for Darkroom
- """
- from django.contrib import admin
- from models import *
- PER_PAGE = 50
- class MovieAdmin(admin.ModelAdmin):
- list_display = ("title", "slug", "created", "published")
- list_filter = ["created", "published"]
- list_per_page = PER_PAGE
- admin.site.register(Movie, MovieAdmin)
- class GalleryAdmin(admin.ModelAdmin):
- list_display = ("title", "slug", "created", "photo_count", "published")
- list_filter = ["created", "published"]
- date_hierarchy = "created"
- filter_horizontal = (
- "towns",
- "sites",
- "photos",
- )
- class PhotographerAdmin(admin.ModelAdmin):
- list_display = ("name",)
- list_filter = ["created"]
- list_per_page = PER_PAGE
- class PhotoAdmin(admin.ModelAdmin):
- list_display = (
- "title",
- "slug",
- "created",
- "published",
- "view_count",
- "admin_thumbnail",
- )
- list_filter = ["created", "published"]
- list_per_page = PER_PAGE
- search_fields = (
- "title",
- "description",
- "photographer__name",
- )
- filter_horizontal = (
- "towns",
- "sites",
- )
- fieldsets = (
- (
- None,
- {
- "fields": (
- "title",
- "slug",
- "description",
- "image",
- "photographer",
- "courtesy",
- "file_photo",
- )
- },
- ),
- (
- "Publishing",
- {
- "fields": (
- "weight",
- "published",
- "published_on",
- "tags",
- "towns",
- "sites",
- )
- },
- ),
- ("Presentation", {"fields": ("crop_from", "effect", "orientation")}),
- )
- class PhotoEffectAdmin(admin.ModelAdmin):
- list_display = ("name", "description", "admin_sample")
- fieldsets = (
- (None, {"fields": ("name", "description")}),
- ("Adjustments", {"fields": ("color", "brightness", "contrast", "sharpness")}),
- ("Filters", {"fields": ("filters",)}),
- (
- "Reflection",
- {"fields": ("reflection_size", "reflection_strength", "background_color")},
- ),
- )
- class PhotoSizeAdmin(admin.ModelAdmin):
- list_display = (
- "name",
- "width",
- "height",
- "crop",
- "pre_cache",
- "effect",
- "increment_count",
- )
- fieldsets = (
- (None, {"fields": ("name", "width", "height", "quality")}),
- ("Options", {"fields": ("upscale", "crop", "pre_cache", "increment_count")}),
- ("Enhancements", {"fields": ("effect", "watermark",)}),
- )
- class WatermarkAdmin(admin.ModelAdmin):
- list_display = ("name", "opacity", "style")
- class GraphicAdmin(admin.ModelAdmin):
- list_display = (
- "title",
- "slug",
- "created",
- "published",
- "view_count",
- "admin_thumbnail",
- )
- list_filter = ["created", "published"]
- list_per_page = PER_PAGE
- admin.site.register(Graphic, GraphicAdmin)
- admin.site.register(Gallery, GalleryAdmin)
- admin.site.register(GalleryUpload)
- admin.site.register(Slideshow)
- admin.site.register(SlideshowUpload)
- admin.site.register(Photographer, PhotographerAdmin)
- admin.site.register(Photo, PhotoAdmin)
- admin.site.register(PhotoEffect, PhotoEffectAdmin)
- admin.site.register(PhotoSize, PhotoSizeAdmin)
- admin.site.register(Watermark, WatermarkAdmin)
- admin.site.register(Webcam)
|