Hello.

I can't understand how I can add some extra fields on form saving.

Here is a simple example:

class Msg(models.Model):
  title = models.CharField(max_length=30)
  message = models.CharField(max_length=100)
  status = models.CharrField(max_length=1,null=True,blank=True)

class MsgForm(ModelForm):
  class Meta:
    model = Msg
    exclude = ('status') ## I don't want users to see it in html form
##

...
status = 'F' ## for example
if request.method == 'POST':
  form = msgForm(request.POST)
  if form.is_valid:
    form.save() ????

How can i set status here? If i set form = msgForm(request.POST,
initial={status:'F'}) - this does nothing.

--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to