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
:
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
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
--~--~-
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
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
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
,
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
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
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
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
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
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
12 matches
Mail list logo