Closed Nerade closed 8 years ago
Sounds logical to me. Please give me some time, so that I can test this in my environment. Thanks for this pull request.
Good for me. We could merge this. An example or a demo would be really appreciated though. (The best would be an addition in the docs !) :wink:
@Nerade would you have the time for that?
Also, seing PR #210 we could use dict comprehension instead of dict()
. Py2.7 is a standard almost everywhere and we do not maintain previous version of python.
Also in #210 , the check is done with if name.startswith(self.prefix + '.')}
IMHO, it's a bit better than just self.prefix in name.
What do you think?
It is great to see my first contributed snippet to get into the project. I see your suggestion. In fact I am still fairly new to python concerning performance and code style issues.
I will further take a look into documentation when I'm home again.
While working on an application with a view in which 4 forms are placed, I have noticed that the NgModelFormMixin grabs the data to each form by looking up a list which is placed as a value in the response data dict with a key equals to the prefix of the nested form. This only applies if the Form is nested to a parent form.
For my case the forms are bundled together on view layer. So there is just one dict with all form data and just seperated by the prefix in the key name.
This behaviour results in a 'NoneType has no method items()' error. To prevent this I have implemented a check if the data.get(self.prefix) is None. If so it will grab the data list by searching for all keys containing the prefix.