Hi,
I am about to start a large Django project at work. And the key features are form handling. There is going to be a lot of forms that the users of the app is going to use. And one requirement is that it should be possible to edit the forms in the admin interface of the application.
That is, it is not a requirement to add/delete form fields. But it should be possible to edit form field attributes. E.g change which fields wich is required and such.
Anybody have any good solutions on how to do this. Im thinking that I might have to subclass the fields I want to be dynamic and do something there. I guess that all the models fields have to have "blank=True/null=True" and some how add some meta information in a separate model(?) about the model wich declares wich fields are required. And then use that information when forms is displayed and validated.
Before i start off doing this I would really like some input in how to design such a solution, anybody got ideas on how it should be done?
After more research, I've learned that you could do a'lot with factory functions that would return the form with the given attributes set. So it looks like the problem is not that hard do solve.
I would make a function that returns a form with the right attributes/fields set. But the part that I haven't found a good solution for is how to manage this in the admin interface. I am thinking that I would make a db.Model that stores information about another models fields. Where I can set wich is required and such.
And then in the function that returns the form, go trough that model and return a form with the right attributes. But how to make that model (wich should mirror another models fields) in a good way?