I think that you can replace

if request.method == 'POST':
        form = WebrequestsForm(request.POST)

with:

if request.method == 'POST':
        form = WebrequestsForm(data=request.POST, own_id=own_id)

as I said in first answer


2012/7/11 mapapage <mapap...@gmail.com>

> I have a legacy db so I have many restrictions and conventions. Anyway,
>> the associated part of views looks like:
>>
>
> def Webrequests(request, user_id):
>
>     try:
>         owner = Owners.objects.get(id=user_id)
>
>      except owner.DoesNotExist:
>         print "There isnt an owner with such id."
>
>     else:
>         lname=owner.lname #epwnumia
>         fname=owner.fname
>         tel=owner.tel1
>         fax=owner.fax1
>         email=owner.email1
>         own_id = user_id
>
>
>     if request.method == 'POST':
>         form = WebrequestsForm(request.POST)
>
>         if form.is_valid():
>             form.save()
>
>             return render_to_response('success.html', locals(),
> context_instance= RequestContext(request))
>     else:
>
>         own_id = user_id
>
>         form = WebrequestsForm(own_id=own_id, initial = {'email':email,
> 'fax':fax, 'tel':tel, 'own_id':own_id})
>
>     return render_to_response('main_Webrequests.html', locals(),
> context_instance= RequestContext(request))
>
> What do u think?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/django-users/-/1myJTSWBIbEJ.
>
> 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.
>

-- 
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