Hi!

I'm starting to use newforms for most of my forms, but I run into a 
problem, which I'm hope has a DRY solution, but I haven't found it yet. 
Here's my model chunk:

class Post(models.Model):
        status  = models.CharField(
                        maxlength = 15, 
                        choices = PUBLICATION_STATUS, 
                        default = 'published')

I use form_for_model and form_for_instance, to create form objects. I 
don't know if there is a way for the newforms to pick my default value 
and auto-select it in a form used to create a new Post.

I could probably hand-code it in the form template, but that will cause 
me to change the template if my default value changes in the model 
(perhaps this example will not change often, but some might).

I understand that newforms and its documentation is not finalized yet, 
but adding a capability to pick up default values from the model would be 
very beneficial. Maybe there are reasons why it's not done automatically, 
which I'm not aware of.

How do you do this in your applications?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to