S
S
sazhyk2017-02-01 13:08:23
Django
sazhyk, 2017-02-01 13:08:23

How to work with a post that can have multiple attachments?

Documents must be kept on record. There may be several documents. How best to realize such a moment? just a field in the model with <input type="file" multiple="multiple">? Or make another model with ForeignKey on this one, display it inline in the form, and save files in it already?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan, 2017-02-09
@ATNC

It will be better to make another with ForeignKey on the document. This way you "encapsulate" the file object and can extend the model in the future. For example, save file download time, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question