django_builder
django_builder copied to clipboard
Import models.py does not retain ForeignKey relations
Thanks for the great tool!
When I import a models.py from a previously exported project to make updates/additions, the ForeignKey relationships between models are not retained.
I have also experienced this.
I looked a little into this. In the ModelParserFactory
, the field regular expression (^([a-zA-Z0-9_]+)\ \=\ ([a-zA-Z0-9._]+)[\(](.*)[\)]$
) does not match the generated relationships because the regular expression expects the entire relationship to be on a single line and the generated relationships cover multiple lines.
I tried putting the foreign keys into one line but still not getting recognised.