News for hackers. Stuff that matters.
Re:Core Concepts of Django Forms by mrweasel on Friday March 29, 2013 @04:55PM (#5462995)
I might have been using an old version of Django, or I did it wrong, but hidden fields seemed to be a major pain with Django forms. Just because a field isn't marked a editable, doesn't mean that it should be included in the form data. It would be nice is editable=False, meant that "You can't edit this field and hidden=True meant: You will not see this field, editable=False would be assumes in this case.

We tried to do a few forms with Django forms, only to find that the designer wanted something that made it easy to just skip the Django forms all together and just do them form by hand.

Re:Core Concepts of Django Forms by pydanny on Friday March 29, 2013 @05:40PM (#5463178)
Hidden fields aren't a problem in Django. Can you provide a code sample demonstrating your issues?
Re:Core Concepts of Django Forms by zalew on Friday March 29, 2013 @05:41PM (#5463183)
you are looking for Meta: exclude = ('field1', 'field2', )

displaying a field as hidden doesn't make it uneditable.

Re:Core Concepts of Django Forms by arocks on Friday March 29, 2013 @02:56PM (#5462368)
Actually, the standard Django documentation on forms is an excellent guide: https://docs.djangoproject.com/en/1.5/topics/forms/
Re:Core Concepts of Django Forms by ambiate on Friday March 29, 2013 @02:42PM (#5462278)
In forms validate dictionaries, the example makes no sense. At first, I assumed this was a duplicate key issue, but I cannot reproduce this problem.

>>> good_form = MyForm({"title": "Two Scoops of Django"}) >>> good_form.is_valid() True >>> good_form.errors {} >>> bad_form = MyForm({"title": "Two Scoops of Django"}) >>> bad_form.is_valid() True >>> bad_form.errors {}

Re:Core Concepts of Django Forms by pydanny on Friday March 29, 2013 @02:47PM (#5462301)
D'oh! Typo on my part. Fixed.
Re:Core Concepts of Django Forms by boffo9 on Friday March 29, 2013 @03:58PM (#5462703)
I wish I read this earlier today. Good article.