News for hackers. Stuff that matters.
Re:Dynamic Django Models with Model Models by shimon on Wednesday August 22, 2018 @08:57AM (#17818360)
I did something like this in an app for art collectors once. My client wanted very different forms and styles for different objects -- say a coin vs. a stamp. The templates to render the forms were thus very complex and specified every field in the form, so rather than define fields in both the Form class and the template, I made a dynamic Form-subclass generator that would read the template file and create the class to process and store it.

Typing that out now, I'm both enjoying the cleverness of that solution and wondering if it was at all justifiable. It probably would have made a good blog post.

There are no comments on this comment yet.