Re: form instance to update an object

2009-06-16 Thread Genis Pujol Hamelink
well, if you retrieve an object via GET modify something and then submit the new data you will create a POST request and I was wondering if I could test wether the object being saved was an existing one or not... greetings, Genis 2009/6/16 Daniel Roseman > > On Jun 15, 4:23 pm, Genis

Re: form instance to update an object

2009-06-15 Thread Genis Pujol Hamelink
: form.save() else: whatever goes here Something like this or do u know a better way? 2009/6/15 Daniel Roseman > > On Jun 15, 3:20 pm, Genis Pujol Hamelink > wrote: > > Hi list, > > > > I am trying to create a view to update obj

form instance to update an object

2009-06-15 Thread Genis Pujol Hamelink
Hi list, I am trying to create a view to update objects in the db: http://dpaste.com/55546/ but when posting the data, form.is_valid() fails because the object already exists in the db. Is there a way to validate a form using an existing object and then save it? regards, -- Genís --~--~-

Re: user.is_authenticated

2009-06-01 Thread Genis Pujol Hamelink
Hi, The variable you want to use should be in every page's default context. #views.py from django.template import RequestContext def myview(request): myvar = foo variables = RequestContext(request, { 'myvar' : myvar }) return render_to_response("template.html", variables) In variab

browser setting takes over /i18n/setlang?language=english

2008-10-31 Thread Genis Pujol Hamelink
Hello, I'm checking out the i18N features and apparently the browser setting takes over always, if I try to select the language via the link it doesn't work, it just falls back to whatever language is set in the browser (i.e. u click and nothing happens, no error messages, nothing). If I change t

Re: re-direction after login successfully

2008-09-05 Thread Genis Pujol Hamelink
You can create a view like: @login_required def index(request): if request.user.is_authenticated(): return HttpResponseRedirect('/go/here/') else: return render_to_response("go/loginpage") gr, G. 2008/9/5 Ken <[EMAIL PROTECTED]> > > You have two options. > > 1) You c

Re: type error in form after upgrade from beta to stable

2008-09-04 Thread Genis Pujol Hamelink
, Genís. 2008/9/4 Karen Tracey <[EMAIL PROTECTED]> > On Thu, Sep 4, 2008 at 10:46 AM, Genis Pujol Hamelink < > [EMAIL PROTECTED]> wrote: > >> Hello, >> >> After upgrading from Django version 1.0-beta_1-SVN-unknown to the Django >> 1.0 stable, I am getti

type error in form after upgrade from beta to stable

2008-09-04 Thread Genis Pujol Hamelink
Hello, After upgrading from Django version 1.0-beta_1-SVN-unknown to the Django 1.0 stable, I am getting this error: Exception Type: TypeError Exception Value: 'NoneType' object is not callable Exception Location: /usr/lib/python2.5/site-packages/django/forms/models.py in __init__, line 197

Re: simple form question

2008-08-21 Thread Genis Pujol Hamelink
s: > form.save(commit=False) > form.autor = request.user > form.save() > > On Aug 21, 12:24 pm, "Genis Pujol Hamelink" <[EMAIL PROTECTED]> > wrote: > > Hello, > > > > I'm trying to pass a the id of the user logged in to a form field, but it > > does

simple form question

2008-08-21 Thread Genis Pujol Hamelink
Hello, I'm trying to pass a the id of the user logged in to a form field, but it doesn't seem to work... any ideas / suggestions? Thanks in advance :) Here are the view, model and form objects: View: def punts_form3(request): if request.method == 'POST': form = form_punt

Re: problems with request.user

2008-08-21 Thread Genis Pujol Hamelink
Hello, I think it's with request.session['_auth_user_id'], but not sure gr, G. On Wed, Aug 20, 2008 at 11:13 PM, Burr Settles <[EMAIL PROTECTED]>wrote: > > I recently came back to a project I put on hold for a couple weeks, > and after updating the Django trunk, all my references to > "r

insert variables into forms? like pass request.session['_auth_user_id'] to {{ form.user }} ?

2008-08-19 Thread Genis Pujol Hamelink
Hi, I'm checking out how to use forms with django and I'm trying to find out how to pass the value of request.session['_auth_user_id'] to the form field which should contain the userid which is {{ form.user }}. How can I tell the view to insert the value of request.session rather than asking the