Exactly, it ignores whatever POST value not related to the model
field. You have to use f.cleaned_data['rating'] to get the rating
value and use it or save it wherever it has to be stored, as Andy
McKay pointed in his comment.

Hector Garcia - Web developer, musician
http://nomadblue.com/



On Fri, Nov 13, 2009 at 11:59 AM, jul <juj...@gmail.com> wrote:
> What happen to the rating field when doing the following?
>
> f = AddRestaurantForm(request.POST)
> f.save()
>
> Does save() only use what it needs to fill the Restaurant instance and
> doesn't use the rating value?
>
>
> On Nov 13, 5:35 am, Andy Mckay <a...@clearwind.ca> wrote:
>> On 09-11-12 2:33 PM, jul wrote:
>>
>> > I've got the Rating model and the AddRestaurantForm shown below. In
>> > order to add a rating when submitting a new restaurant, I added an
>> > extra field to AddRestaurantForm. Can I do that? If I can, how can I
>> > save separately the Restaurant instance and the rating instance (I'll
>> > get the user from the context)?
>>
>> Sure that works just fine.
>>
>> When you save the form, you'll save the restaurant instance. You can
>> then get the rating from the forms.cleaned_data and save that however
>> you'd like.
>> --
>>    Andy McKay
>>   �...@clearwind
>>    Training:http://clearwind.ca/training/
>>    Zen:http://djangozen.com
>
> --
>
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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=.
>
>
>

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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=.


Reply via email to