FileField Support
workshop22 opened this issue · comments
Awesome work with this! Would you happen to have any plans to support models.FileField?
It'd be great if FileField would look the same as ImageField.
class UnfoldAdminFileFieldWidget(FileFieldMixin, AdminFileWidget):
template_name = "unfold/widgets/clearable_file_input_small.html"
=>
class UnfoldAdminFileFieldWidget(FileFieldMixin, AdminFileWidget):
template_name = "unfold/widgets/clearable_file_input.html"
class UnfoldAdminFileFieldWidget(FileFieldMixin, AdminFileWidget): template_name = "unfold/widgets/clearable_file_input_small.html"
=>
class UnfoldAdminFileFieldWidget(FileFieldMixin, AdminFileWidget): template_name = "unfold/widgets/clearable_file_input.html"
I still have much to learn in Django, but this helped me a lot, thanks so much!
can you help me how can i access the uploaded folder as I can only see his path without being able to see the doc itself
`
class WorkingDocumentation(BaseModel):
business_license = models.FileField(
upload_to="company_docs/",
null=True,
)
class UnfoldAdminFileFieldWidget(FileFieldMixin, AdminFileWidget):
template_name = "unfold/widgets/clearable_file_input.html"
class WorkingDocumentationForm(forms.ModelForm):
class Meta:
model = WorkingDocumentation
fields = 'all'
widgets = {
'business_license': UnfoldAdminFileFieldWidget(),
}
@admin.register(WorkingDocumentation)
class WorkingDocumentationAdmin(ModelAdmin):
form = WorkingDocumentationForm
`