News for hackers. Stuff that matters.
Re:Dynamic Django Models with Model Models by babayega2 on Wednesday August 22, 2018 @09:53AM (#17818664)
> You may even be able to have referential consistency using a ForeignKey field

Since you say "you may" ... , do you happen to see any problem that may arise with this implementation ?

Re:Dynamic Django Models with Model Models by spapas82 on Wednesday August 22, 2018 @10:07AM (#17818745)
Well, the original article doesn't actually mention ForeignKeys that's why I written may (it only has TextField and IntegerField). Of course nothing stops you from extending them; you'll need to of course add the model where you'll want to create an FK to.

So the MakeField model will have an optional field to denote the class to which you want to create the FK; probably an FK to ContentType would suffice for this field (https://docs.djangoproject.com/en/2.1/ref/contrib/contenttyp...).

I know I've written field and FK too many times, I hope it makes sense; if it doesn't tell me and I'll provide a more thorough example.