File tree Expand file tree Collapse file tree 4 files changed +10
-11
lines changed
src/unfold/contrib/import_export
templates/admin/import_export Expand file tree Collapse file tree 4 files changed +10
-11
lines changed Original file line number Diff line number Diff line change 77
88def export_action_form_factory (formats ):
99 class _ExportActionForm (ActionForm ):
10- file_format = forms .ChoiceField (
10+ format = forms .ChoiceField (
1111 label = " " ,
1212 choices = formats ,
1313 required = False ,
Original file line number Diff line number Diff line change 1- from import_export .forms import ExportForm as BaseExportForm
2- from import_export .forms import ImportForm as BaseImportForm
1+ from import_export .forms import ImportExportFormBase as BaseImportExportFormBase
32from unfold .widgets import SELECT_CLASSES , UnfoldAdminFileFieldWidget
43
54
6- class ImportForm (BaseImportForm ):
5+ class ImportForm (BaseImportExportFormBase ):
76 def __init__ (self , * args , ** kwargs ):
87 super ().__init__ (* args , ** kwargs )
9- self .fields ["import_file " ].widget = UnfoldAdminFileFieldWidget ()
10- self .fields ["input_format " ].widget .attrs ["class" ] = " " .join (SELECT_CLASSES )
8+ self .fields ["resource " ].widget = UnfoldAdminFileFieldWidget ()
9+ self .fields ["format " ].widget .attrs ["class" ] = " " .join (SELECT_CLASSES )
1110
1211
13- class ExportForm (BaseExportForm ):
12+ class ExportForm (BaseImportExportFormBase ):
1413 def __init__ (self , * args , ** kwargs ):
1514 super ().__init__ (* args , ** kwargs )
16- self .fields ["file_format " ].widget .attrs ["class" ] = " " .join (SELECT_CLASSES )
15+ self .fields ["format " ].widget .attrs ["class" ] = " " .join (SELECT_CLASSES )
Original file line number Diff line number Diff line change 3737 {% csrf_token %}
3838
3939 < fieldset class ="border border-gray-200 mb-8 rounded-md pt-3 px-3 shadow-sm dark:border-gray-800 ">
40- {% include "unfold/helpers/field.html" with field=form.file_format %}
40+ {% include "unfold/helpers/field.html" with field=form.format %}
4141 </ fieldset >
4242
4343 < button type ="submit " class ="bg-primary-600 border border-transparent font-medium px-3 py-2 rounded-md text-sm text-white ">
Original file line number Diff line number Diff line change 2222 </ p >
2323
2424 < fieldset class ="border border-gray-200 mb-8 rounded-md pt-3 px-3 shadow-sm dark:border-gray-800 ">
25- {% include "unfold/helpers/field.html" with field=form.import_file %}
25+ {% include "unfold/helpers/field.html" with field=form.resource %}
2626
27- {% include "unfold/helpers/field.html" with field=form.input_format %}
27+ {% include "unfold/helpers/field.html" with field=form.format %}
2828 </ fieldset >
2929
3030
You can’t perform that action at this time.
0 commit comments