On Sun, Dec 21, 2008 at 1:47 PM, Daniel Roseman <
[email protected]> wrote:
>
>
> You won't see errors because you haven't included them in your
> template. Either render the whole form with {{ form.as_p }} - which
> will render the errors as well - or for each field include a reference
> to that field's errors - {{ form.fieldname.errors }} - plus
> {{ form.non_field_errors }} at the top of the form
Yes, that showed me the errors. Very helpful.
>
>
> If you've got a non-blank field in your model that you don't want to
> display in your form, make sure you include it in the exclude list in
> the inner Meta class. Then set it the value manually in your view.
>
> class MyForm(forms.ModelForm):
> class Meta:
> exclude=['pub_date']
So I put this in my model directly? Under the class definition, or?
>
>
> ... in the view ...
> if request.method=='POST':
> form = MyForm(request.POST)
> if form.is_valid()
> new_obj = form.save(commit=True)
> new_obj.pub_date=datetime.date.today()
> new_obj.save()
OK, I get that, but I'm trying to use the generic views, so is this
applicable to my use case?
Thanks for the help!!
Greg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---