1

I have a class named city. For this city, I have a filefield variable to upload the files. But I need to upload multiple files all at once in a single field in the Admin site (localhost:8000/admin). Could you please guide me with a sample code to get a clear idea about the implementation or suggest to me the implementation plan of doing it?

  • You want to upload multiple files to a single FileField? – Ersain Mar 13 '22 at 07:24
  • Yes @Ersain, I want to do that in the Admin site of Django application when adding the new data. – Dheeraj Yandrapu Mar 13 '22 at 09:05
  • 1
    Okay, but how do you think the single filefield will handle multiple files in it? You need a one-to-many or many-to-many relation to handle such things, then it will be no problem to add multiple input fields in admin (using either StackedInline or TabularInline) – Ersain Mar 13 '22 at 09:10
  • @Ersain, I am using one-to-many relation between the City model and the file model. Will this works StackedInLine or TabularInLine for the issue? and multiple files upload in the sense, it can be variable. – Dheeraj Yandrapu Mar 13 '22 at 09:47
  • 1
    yes, of course. – Ersain Mar 13 '22 at 10:06

0 Answers0