1 from django.contrib import admin
2 from django import forms
5 from django.conf import settings
9 admin.site.register(explorer.models.EditorSettings)
10 admin.site.register(explorer.models.EditorPanel)
13 class GalleryAdminForm(forms.ModelForm):
14 subpath = forms.ChoiceField(choices=())
16 def __init__(self, *args, **kwargs):
17 super(GalleryAdminForm, self).__init__(*args, **kwargs)
18 self.fields['subpath'].choices = [(settings.IMAGE_DIR + '/' + x, x) for x in os.listdir(settings.MEDIA_ROOT + settings.IMAGE_DIR)]
21 mode = explorer.models.GalleryForDocument
22 fields = ('document', 'subpath',)
25 class GalleryAdmin(admin.ModelAdmin):
26 form = GalleryAdminForm
27 list_display = ('document', 'subpath',)
28 search_fields = ('document', 'subpath',)
30 admin.site.register(explorer.models.GalleryForDocument, GalleryAdmin)