django_builder icon indicating copy to clipboard operation
django_builder copied to clipboard

Import models.py does not retain ForeignKey relations

Open rajeshlal opened this issue 5 years ago • 3 comments

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.

rajeshlal avatar Mar 23 '19 14:03 rajeshlal

I have also experienced this.

FluxIX avatar Jun 21 '19 14:06 FluxIX

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.

FluxIX avatar Jun 21 '19 19:06 FluxIX

I tried putting the foreign keys into one line but still not getting recognised.

andymc100 avatar Oct 04 '21 20:10 andymc100