bgneal@1
|
1 """ Newforms Admin configuration for Photologue
|
bgneal@1
|
2
|
bgneal@1
|
3 """
|
bgneal@1
|
4 from django.contrib import admin
|
bgneal@1
|
5 from models import *
|
bgneal@1
|
6
|
bgneal@1
|
7 class GalleryAdmin(admin.ModelAdmin):
|
bgneal@1
|
8 list_display = ('title', 'date_added', 'photo_count', 'is_public')
|
bgneal@1
|
9 list_filter = ['date_added', 'is_public']
|
bgneal@1
|
10 date_hierarchy = 'date_added'
|
bgneal@1
|
11 prepopulated_fields = {'title_slug': ('title',)}
|
bgneal@1
|
12 filter_horizontal = ('photos',)
|
bgneal@1
|
13
|
bgneal@1
|
14 class PhotoAdmin(admin.ModelAdmin):
|
bgneal@1
|
15 list_display = ('title', 'date_taken', 'date_added', 'is_public', 'tags', 'view_count', 'admin_thumbnail')
|
bgneal@1
|
16 list_filter = ['date_added', 'is_public']
|
bgneal@1
|
17 list_per_page = 10
|
bgneal@1
|
18 prepopulated_fields = {'title_slug': ('title',)}
|
bgneal@1
|
19
|
bgneal@1
|
20 class PhotoEffectAdmin(admin.ModelAdmin):
|
bgneal@1
|
21 list_display = ('name', 'description', 'admin_sample')
|
bgneal@1
|
22 fieldsets = (
|
bgneal@1
|
23 (None, {
|
bgneal@1
|
24 'fields': ('name', 'description')
|
bgneal@1
|
25 }),
|
bgneal@1
|
26 ('Adjustments', {
|
bgneal@1
|
27 'fields': ('color', 'brightness', 'contrast', 'sharpness')
|
bgneal@1
|
28 }),
|
bgneal@1
|
29 ('Filters', {
|
bgneal@1
|
30 'fields': ('filters',)
|
bgneal@1
|
31 }),
|
bgneal@1
|
32 ('Reflection', {
|
bgneal@1
|
33 'fields': ('reflection_size', 'reflection_strength', 'background_color')
|
bgneal@1
|
34 }),
|
bgneal@1
|
35 )
|
bgneal@1
|
36
|
bgneal@1
|
37 class PhotoSizeAdmin(admin.ModelAdmin):
|
bgneal@1
|
38 list_display = ('name', 'width', 'height', 'crop', 'pre_cache', 'effect', 'increment_count')
|
bgneal@1
|
39 fieldsets = (
|
bgneal@1
|
40 (None, {
|
bgneal@1
|
41 'fields': ('name', 'width', 'height', 'quality')
|
bgneal@1
|
42 }),
|
bgneal@1
|
43 ('Options', {
|
bgneal@1
|
44 'fields': ('upscale', 'crop', 'pre_cache', 'increment_count')
|
bgneal@1
|
45 }),
|
bgneal@1
|
46 ('Enhancements', {
|
bgneal@1
|
47 'fields': ('effect', 'watermark',)
|
bgneal@1
|
48 }),
|
bgneal@1
|
49 )
|
bgneal@1
|
50
|
bgneal@1
|
51 class WatermarkAdmin(admin.ModelAdmin):
|
bgneal@1
|
52 list_display = ('name', 'opacity', 'style')
|
bgneal@1
|
53
|
bgneal@1
|
54
|
bgneal@1
|
55 admin.site.register(Gallery, GalleryAdmin)
|
bgneal@1
|
56 admin.site.register(GalleryUpload)
|
bgneal@1
|
57 admin.site.register(Photo, PhotoAdmin)
|
bgneal@1
|
58 admin.site.register(PhotoEffect, PhotoEffectAdmin)
|
bgneal@1
|
59 admin.site.register(PhotoSize, PhotoSizeAdmin)
|
bgneal@1
|
60 admin.site.register(Watermark, WatermarkAdmin) |