1👍
I think the best way to organize your ‘SysApp – documents’ relationship, assuming that each document is related to only one sysapp, is to use ForeignKey
, as you mentioned.
In that case you’ll only have to create 2 models: the first one is SysApp
with a name
field and the second is Document
with fields title
, url to file
, description
and a foreignkey
to SysApp
. Now you can create documents and attach them to the sys you want. So you do not need to specify document_2
, document_3
etc. fields.
If you need to attach one document to more than one sysapp use ManyToMany
instead of ForeignKey
.
Source:stackexchange.com