X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/113e9584a18733aabe8a2ec20862eb6f5ed4b62d..061f517181630ee982c33aee63965b18965fd5aa:/apps/explorer/admin.py diff --git a/apps/explorer/admin.py b/apps/explorer/admin.py index c84a5d93..dd765f59 100644 --- a/apps/explorer/admin.py +++ b/apps/explorer/admin.py @@ -1,29 +1,13 @@ from django.contrib import admin -from django import forms -import os - -from django.conf import settings import explorer.models +from explorer import forms admin.site.register(explorer.models.EditorSettings) admin.site.register(explorer.models.EditorPanel) - -class GalleryAdminForm(forms.ModelForm): - subpath = forms.ChoiceField(choices=()) - - def __init__(self, *args, **kwargs): - super(GalleryAdminForm, self).__init__(*args, **kwargs) - self.fields['subpath'].choices = [(settings.IMAGE_DIR + '/' + x, x) for x in os.listdir(settings.MEDIA_ROOT + settings.IMAGE_DIR)] - - class Meta: - mode = explorer.models.GalleryForDocument - fields = ('document', 'subpath',) - - class GalleryAdmin(admin.ModelAdmin): - form = GalleryAdminForm + form = forms.GalleryChoiceForm list_display = ('document', 'subpath',) search_fields = ('document', 'subpath',)