Sunday, September 28, 2014

Re: Django Generic Create VIew and Hidden fields

On Sun, Sep 28, 2014 at 5:49 PM, Sabine Maennel
<sabine.maennel@gmail.com> wrote:
> Can someone please help me with Create View? I have a hidden field and not
> having it in the form causes Django to not store my object in the database.
> It fails silently.
>
> So here are my files:
>
> model.py:
> class Application(TimeStampedModel):
> name = models.CharField(max_length=50)
> application_status = models.CharField(max_length=1,
> choices=APPLICATION_STATUS, default=APPLICATION_NEW)
>
> def __unicode__(self):
> return self.name
>
> def save(self):
> self.application_status ==self.APPLICATION_NEW

This overwritten save method is probably at fault - it does not ever
actually save the model or call the parent class to do so either.

Cheers

Tom

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1K4whpWkUSCyJ0ymhSr34i8AaX3aqgOMOi8N4SxxZ0oXA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment