Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListField fails to display in form if "null=True" set in model. #41

Open
OneOfMany07 opened this issue Aug 20, 2013 · 0 comments
Open

Comments

@OneOfMany07
Copy link

I've been having a ton of trouble getting a ListField to work, even after following the very useful example at https://gist.github.com/jonashaag/1200165

I finally traced it down to adding "null=True" to my list of attributes in the models.py file. If I remove that entry I can see the form fine, but if I add it back in the "form.as_p" call returns nothing in the template.

Looking in the debugger the form object looks different too. The text representation is the python default object ID when the form is broken. When it would display I see the HTML code that would get output for the items in my form.

Now I'm not sure this will show up in the example above, but the code change I'd make would be...

categories = CategoryField()

becomes...

categories = CategoryField(null=True)

I had added that to work around existing documents that didn't have my new ListField value. I assumed the model verification would fail somewhere if there were existing documents without a value in a field that can't be null or blank.

My app is really long and I'm hoping this is enough to reproduce the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant