Tuesday, June 12, 2007

What a day

It's the end of the second day and we covered a lot of ground -- admin, views, templates and newforms.

The biggest knowledge gain for me was newforms -- they're very nice. I'm no slouch when it comes to HTML, but this is one task I'm glad Django automates for me. I've spent enough time debugging/writing code to handle form input/form generation -- this is really one area where I think Django shines above Rails (not that they're competing against each other... they're just the two "next gen" frameworks I've tried).

One thing that did bug me is that there must be a better way to remove the "------" choice from a Django ForeignKey <select> representation than my way:

good_choices = []
for choice in Form.base_fields['todo_list'].widget.choices:
if choice[0]:
#Cuz if it's false, it's probably the stupid -------- choice
good_choices.append(choice)

Form.base_fields['todo_list'].widget.choices = good_choices


Tomorrow is Forms Part II....

1 comment:

michael said...
This comment has been removed by the author.