El vie, 04-04-2008 a las 14:09 -0700, [EMAIL PROTECTED] escribió:
> def add(request,form_class=PlaceForm):
>     if request.method == 'POST':
>         form = form_class(request.POST)
>         if form.is_valid():
>             form.save(request)
>             return render_to_response('places/added.html',  {'form' :
> form},)  #IF ALL OK
[...]
> The problem is, I don't
> know how to send a place.name to a "added.html" template, because view

I assume "PlaceForm" is a ModelForm? Then, from:
http://www.djangoproject.com/documentation/modelforms/#the-save-method
you'll see that save() returns the created object, so:

  new_place = form.save(request)
    return render_to_response('places/added.html',  {'form' : form, 'place': 
new_place}

should do the trick.

Hope this helps,
Marc

-- 
http://www.marcfargas.com -- will be finished some day.

Attachment: signature.asc
Description: Esta parte del mensaje está firmada digitalmente

Reply via email to