X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/54d7b5abd1eddc6f22f8d3df75334a54a1420485..f24caa48eedfb9d4f7218892bc7070316ac553f2:/apps/explorer/admin.py?ds=inline diff --git a/apps/explorer/admin.py b/apps/explorer/admin.py index 097514a9..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 = [(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',)