Re: Session Variables

2017-05-30 Thread Russell Keith-Magee
Please stop spreading FUD like this. The Django Community Code of Conduct isn’t 
a blunt instrument attempting to stop all dissent or disagreement. It’s there 
to ensure that everyone treats everyone else with respect in all communications.

The fact that Daniel criticised Hungarian notation is in *no* way a violation 
of the CoC. It’s fine to have opinions about Hungarian notation (or any other 
technology or stylistic choice, for that matter). However, the dismissive and 
contemptuous tone he used to voice his disapproval *is* a likely violation of 
the CoC.

So - go right ahead and have opinions. Just choose your words when you voice 
them, and remember: we’re all humans; we can all have different opinions and 
preferences; and there may be situations and circumstances that affect those 
choices that aren’t always obvious on first inspection.

Yours,
Russ Magee %-)

On 31 May 2017, 4:08 AM +0800, ludovic coues , wrote:
> Pretty sure the django code of conduct is against criticizing the use
> of Hungarian notation.
>
> 2017-05-29 12:29 GMT+02:00 Daniel Roseman :
> > On Monday, 29 May 2017 06:04:02 UTC+1, James Schneider wrote:
> > >
> > >
> > > On May 28, 2017 9:35 AM,  wrote:
> > >
> > >
> > > tFetchData = users.objects.get(emailid = lEmailId)
> > >
> > > request.session['sPassword'] = tFetchData.userroles
> > > request.session['sCompanyId'] = tFetchData.companyid
> > >
> > > This code didn't appear to have anything to do with your question.
> >
> >
> > Also, Hungarian notation? Really?
> >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at https://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> > https://groups.google.com/d/msgid/django-users/5427f3fe-4345-41b4-9a46-c0b037ece73b%40googlegroups.com.
> >
> > For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
>
> Cordialement, Ludovic Coues
> +33 6 14 87 43 42
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAEuG%2BTZWJo3kX3AjFR_Lkf7JRkkVVjwrTMTQo9KkKZjmMoFZxQ%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/acb46478-8232-4154-ab65-b15563cecb12%40Spark.
For more options, visit https://groups.google.com/d/optout.


Re: Session Variables

2017-05-30 Thread ludovic coues
Pretty sure the django code of conduct is against criticizing the use
of Hungarian notation.

2017-05-29 12:29 GMT+02:00 Daniel Roseman :
> On Monday, 29 May 2017 06:04:02 UTC+1, James Schneider wrote:
>>
>>
>> On May 28, 2017 9:35 AM,  wrote:
>>
>>
>>  tFetchData = users.objects.get(emailid = lEmailId)
>>
>> request.session['sPassword'] = tFetchData.userroles
>> request.session['sCompanyId'] = tFetchData.companyid
>>
>> This code didn't appear to have anything to do with your question.
>
>
> Also, Hungarian notation? Really?
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/5427f3fe-4345-41b4-9a46-c0b037ece73b%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



-- 

Cordialement, Ludovic Coues
+33 6 14 87 43 42

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEuG%2BTZWJo3kX3AjFR_Lkf7JRkkVVjwrTMTQo9KkKZjmMoFZxQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Session Variables

2017-05-29 Thread Daniel Roseman
On Monday, 29 May 2017 06:04:02 UTC+1, James Schneider wrote:
>
>
> On May 28, 2017 9:35 AM,  wrote:
>
>
>  tFetchData = users.objects.get(emailid = lEmailId)
>
> request.session['sPassword'] = tFetchData.userroles
> request.session['sCompanyId'] = tFetchData.companyid
>
> This code didn't appear to have anything to do with your question.
>

Also, Hungarian notation? Really?
 

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/5427f3fe-4345-41b4-9a46-c0b037ece73b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Session Variables

2017-05-28 Thread James Schneider
On May 28, 2017 9:35 AM, <yeddu.j.pra...@gmail.com> wrote:

Dear Experts, I am new to Django and need your help.

I want a set of variables populated into session variables. These will be
fixed values for the user such as which company he belongs to, his email
id, his role etc.


These values will be read from the database by the login form. These values
need to stay in these variables as long as the user is logged into the
application.


I will be using these variables to decide what data the user can see.


This sounds like a rudimentary permission system. Instead of keeping
permissions in the session, I would suggest using the built-in permissions,
or extending the authorization system using something like Django-guardian.


Question I have is "Will these values be different for each user who is
logged in or are these global to the application and all the users will see
these same values?


Each session is unique to each user. If you need something global to the
system, the session is definitely not the place to put it.

I am using the below code to get the values from the table called "users"
where userroles, companyid are fields in the table

 tFetchData = users.objects.get(emailid = lEmailId)

request.session['sPassword'] = tFetchData.userroles
request.session['sCompanyId'] = tFetchData.companyid

This code didn't appear to have anything to do with your question.

-James

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciU_E1D2QAT1Nn_ucvkJ3C_5PyLFJ3cbqR%2Br%2BACCOra%2BJQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Session Variables

2017-05-28 Thread yeddu . j . prasad
Dear Experts, I am new to Django and need your help.

I want a set of variables populated into session variables. These will be 
fixed values for the user such as which company he belongs to, his email 
id, his role etc. 

These values will be read from the database by the login form. These values 
need to stay in these variables as long as the user is logged into the 
application.

I will be using these variables to decide what data the user can see.

Question I have is "Will these values be different for each user who is 
logged in or are these global to the application and all the users will see 
these same values?

I am using the below code to get the values from the table called "users" 
where userroles, companyid are fields in the table

 tFetchData = users.objects.get(emailid = lEmailId)

request.session['sPassword'] = tFetchData.userroles
request.session['sCompanyId'] = tFetchData.companyid

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1b6fdc83-26dd-4d7f-879c-95aacc282f59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to clear all session variables without getting logged out?

2013-04-16 Thread Cody Scott
I am trying to clear all of the session variables but not logout the 
current user.

user = request.session.get('member_id', None)
request.session.flush()
request.session.modified = True
request.session['member_id'] = user
request.session.modified = True


Will this also affect other users of the site?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Comment Framework and Session Variables

2011-09-21 Thread Andres Reyes
One possible way would be to create your own template tag and use it instead
of the provided one. I did it recently and it's not that complicated, you
should use the code for the current one as an starting point and just extend
it to accept some custom parameter you provide, in this case the email
field.

Regards

2011/9/21 SixDegrees <paulcarli...@comcast.net>

>
> I'm using the Django-supplied comment framework, and I would like to
> initialize the email field of the comment form with a value stored in a
> session variable. The forms, however, are created using template tags; they
> aren't instantiated in the view, for example, where I could easily provide
> the session value as part of the 'initial' dictionary. I don't see any way
> in the template to pass this value along so the form can make use of it.
> How
> can I do this?
> --
> View this message in context:
> http://old.nabble.com/Comment-Framework-and-Session-Variables-tp32503766p32503766.html
> Sent from the django-users mailing list archive at Nabble.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-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.
>
>


-- 
Andrés Reyes Monge
armo...@gmail.com
+(505)-8873-7217

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



Comment Framework and Session Variables

2011-09-21 Thread SixDegrees

I'm using the Django-supplied comment framework, and I would like to
initialize the email field of the comment form with a value stored in a
session variable. The forms, however, are created using template tags; they
aren't instantiated in the view, for example, where I could easily provide
the session value as part of the 'initial' dictionary. I don't see any way
in the template to pass this value along so the form can make use of it. How
can I do this?
-- 
View this message in context: 
http://old.nabble.com/Comment-Framework-and-Session-Variables-tp32503766p32503766.html
Sent from the django-users mailing list archive at Nabble.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-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.



Re: Jumping from Django to php : maintaining session variables..

2010-07-06 Thread euan.godd...@googlemail.com
I think the solution is pretty self-explanatory. Could you give
details of the specific problem you're encountering, because, as far
as I can see, the snippet given in the referenced post is excellent,
although I fail to see why any one would want to support a cross-PHP/
python application out of choice!

On Jul 6, 9:10 am, Sudharshan  wrote:
> Hello ppl,
>
>  I have a situation here which is aptly described by an earlier 
> posthttp://groups.google.com/group/django-users/msg/a492cb9394b0db4d
>
> But my problem is that even after doing whatever the post says i am
> not able to get away with the problem Can someone revisit the
> solution to the problem again by giving clear explanation as to the
> "mechanism of how things happen" which would make things easier when i
> have to tweak my django/php code respectively according to my
> needs...
>
> Thanks
> Sudharshan

-- 
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=en.



Jumping from Django to php : maintaining session variables..

2010-07-06 Thread Sudharshan
Hello ppl,

 I have a situation here which is aptly described by an earlier post
http://groups.google.com/group/django-users/msg/a492cb9394b0db4d

But my problem is that even after doing whatever the post says i am
not able to get away with the problem Can someone revisit the
solution to the problem again by giving clear explanation as to the
"mechanism of how things happen" which would make things easier when i
have to tweak my django/php code respectively according to my
needs...

Thanks
Sudharshan

-- 
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=en.



Re: how do you use session variables in template tags?

2009-09-03 Thread Brandon

Is the request object present in your context? I believe you'd have to
pass in the request, or make it available to the template via
request_context and or the django.core.context_processors.request
middleware.

HTH,
Brandon

On Sep 3, 8:21 am, Bobby Roberts  wrote:
> I cannot for the life of me get a session variable to work in a
> template tag.  Here's what I have
>
> ...
> from django.contrib.sessions.models import Session
>
> register = template.Library()
>
> @register.filter(name='isinsavedlist')
> # this gets the latest new item from the new item flex mod
> def isinsavedlist(request):
>     try:
>         myval=int(request)
>     except:
>         myval=0
>
>     assert False, request.session["mylist[]"]
>
> When it tries to assert the value for mylist, i get the following:
>
> 'long' object has no attribute 'session'
>
> what am I doing wrong?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



how do you use session variables in template tags?

2009-09-03 Thread Bobby Roberts

I cannot for the life of me get a session variable to work in a
template tag.  Here's what I have

...
from django.contrib.sessions.models import Session

register = template.Library()

@register.filter(name='isinsavedlist')
# this gets the latest new item from the new item flex mod
def isinsavedlist(request):
try:
myval=int(request)
except:
myval=0

assert False, request.session["mylist[]"]


When it tries to assert the value for mylist, i get the following:

'long' object has no attribute 'session'


what am I doing wrong?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Accessing session variables in template with django

2009-05-23 Thread Puneet

Thanks Daniel,

Its working fine now. :)

On May 23, 1:39 am, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On May 23, 6:34 am, Puneet <look4pun...@gmail.com> wrote:
>
>
>
> > Hi All,
>
> > I am facing issue when I am trying to access session variables in
> > django.
>
> > I am setting the session variable something like :
>
> >  request.session['cityname'] = cityname
> >  c = RequestContext(request, {'current_date': now})
> >  html = t.render(c)
> >  return HttpResponse(html)
>
> > And I am trying to access it like :
>
> > {{ request.session.cityname }}
> > and
> > {{ request.cityname }}
>
> > But it does not seem to be working. Any suggestions ?
>
> > Thanks,
> > Puneet
>
> You need to enable django.core.context_processors.request in the
> CONTEXT_PROCESSORS section settings.py - it's not enabled by default.
> Seehttp://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-c...
> --
> DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Accessing session variables in template with django

2009-05-23 Thread Daniel Roseman

On May 23, 6:34 am, Puneet <look4pun...@gmail.com> wrote:
> Hi All,
>
> I am facing issue when I am trying to access session variables in
> django.
>
> I am setting the session variable something like :
>
>  request.session['cityname'] = cityname
>  c = RequestContext(request, {'current_date': now})
>  html = t.render(c)
>  return HttpResponse(html)
>
> And I am trying to access it like :
>
> {{ request.session.cityname }}
> and
> {{ request.cityname }}
>
> But it does not seem to be working. Any suggestions ?
>
> Thanks,
> Puneet

You need to enable django.core.context_processors.request in the
CONTEXT_PROCESSORS section settings.py - it's not enabled by default.
See
http://docs.djangoproject.com/en/dev/ref/templates/api/#django-core-context-processors-request
--
DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Accessing session variables in template with django

2009-05-23 Thread Puneet

Hi All,

I am facing issue when I am trying to access session variables in
django.

I am setting the session variable something like :

 request.session['cityname'] = cityname
 c = RequestContext(request, {'current_date': now})
 html = t.render(c)
 return HttpResponse(html)

And I am trying to access it like :

{{ request.session.cityname }}
and
{{ request.cityname }}

But it does not seem to be working. Any suggestions ?

Thanks,
Puneet



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



Sounding out form state preservation with session variables?

2009-04-28 Thread Alfonso

Hi,

I've got a form with a number of checkboxes that allow a user to
filter their search query based on the usual suspects of things like
location, facilities etc.  So now I need a way to preserve these
checked options after the form is submitted to allow the user to
adjust what they are looking for (the same form appears on the search
results page).

I've found a solution in using the sessions framework to capture the
checked options in the get header and send back a simple boolean to
the form view so I can say:


{% if england %}

{% else %}

{% endif %}England


This works but of course I'll need to set a boolean for each checked
option (of which there are about 20).  My question is - is this the
most efficient way I can get this functionality??

Thanks


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



Re: Working with Forms and Session Variables

2009-02-11 Thread Daniel Roseman

On Feb 11, 4:11 pm, gbd  wrote:
> Another point (sorry I should have said this in my original post)
>
> My form is bound
> i.e. in my view
> form = RecipeForm(request.POST)
> I don't believe that I can use initial in this case?
>
> please let me know if I've misunderstood
>
> thanks again!
>
> On Feb 11, 11:06 am, gbd  wrote:
>
> > Thanks!
>
> > A follow up question -
>
> > Would i exclude that field in my class description?
> > i.e.
>
> > class RecipeForm(forms.ModelForm):
> >         class Meta:
> >                 model = Recipes
> >                 exclude = ('user',)
>

The standard Django idiom for a form view is like this:

if request.method='POST':
form = MyForm(request.POST)
if form.is_valid():
form.save()
return HttpResponseRedirect('whatever')
else:
form = MyForm(initial=initial_data)
return render_to_response(template, {'form':form})

So the form is only bound the second time through, when you return
with a POST. The first time through, when you initially render the
form for the user to fill in, you don't have a POST, and the form
isn't bound. It's there - the second-to-last line in my example - that
you should pass the initial dictionary.

And in response to your other question, no you shouldn't exclude that
from the form, or this method won't work.

There is an alternative method, though. If you don't want the user
field to appear at all, exclude the field, don't bother with initial,
and set the user on save. So in line 4 above, you would do this:
instance = form.save(commit=False)
instance.user = request.user
instance.save()

--
DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Working with Forms and Session Variables

2009-02-11 Thread gbd

Thanks for all your help it's much appreciated. I will work with both
methods and see if i can get them to work!

Thanks again

On Feb 11, 12:13 pm, Daniel Roseman 
wrote:
> On Feb 11, 4:11 pm, gbd  wrote:
>
>
>
> > Another point (sorry I should have said this in my original post)
>
> > My form is bound
> > i.e. in my view
> > form = RecipeForm(request.POST)
> > I don't believe that I can use initial in this case?
>
> > please let me know if I've misunderstood
>
> > thanks again!
>
> > On Feb 11, 11:06 am, gbd  wrote:
>
> > > Thanks!
>
> > > A follow up question -
>
> > > Would i exclude that field in my class description?
> > > i.e.
>
> > > class RecipeForm(forms.ModelForm):
> > >         class Meta:
> > >                 model = Recipes
> > >                 exclude = ('user',)
>
> The standard Django idiom for a form view is like this:
>
> if request.method='POST':
>     form = MyForm(request.POST)
>     if form.is_valid():
>         form.save()
>         return HttpResponseRedirect('whatever')
> else:
>     form = MyForm(initial=initial_data)
> return render_to_response(template, {'form':form})
>
> So the form is only bound the second time through, when you return
> with a POST. The first time through, when you initially render the
> form for the user to fill in, you don't have a POST, and the form
> isn't bound. It's there - the second-to-last line in my example - that
> you should pass the initial dictionary.
>
> And in response to your other question, no you shouldn't exclude that
> from the form, or this method won't work.
>
> There is an alternative method, though. If you don't want the user
> field to appear at all, exclude the field, don't bother with initial,
> and set the user on save. So in line 4 above, you would do this:
>         instance = form.save(commit=False)
>         instance.user = request.user
>         instance.save()
>
> --
> DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Working with Forms and Session Variables

2009-02-11 Thread gbd

Another point (sorry I should have said this in my original post)

My form is bound
i.e. in my view
form = RecipeForm(request.POST)
I don't believe that I can use initial in this case?

please let me know if I've misunderstood

thanks again!



On Feb 11, 11:06 am, gbd <ganit.bar...@gmail.com> wrote:
> Thanks!
>
> A follow up question -
>
> Would i exclude that field in my class description?
> i.e.
>
> class RecipeForm(forms.ModelForm):
>         class Meta:
>                 model = Recipes
>                 exclude = ('user',)
>
> On Feb 11, 10:54 am, Daniel Roseman <roseman.dan...@googlemail.com>
> wrote:
>
> > On Feb 11, 3:20 pm, gbd <ganit.bar...@gmail.com> wrote:
>
> > > Hello,
>
> > > I am presently working on my first Django project and seemed to be a
> > > little stuck concerning session variables and forms.
>
> > > This is how my app is laid out:
> > > - user logs in and is directed to a "you have successfully logged in"
> > > page
> > > - user is then redirected to what i am hoping to be an account page
> > > where they can submit information using a form
> > > - this form is a ModelForm (which I believe makes a difference)
> > > - since the user has already logged in I would like the user field on
> > > this form to be defaulted
>
> > > This is where I am having trouble, where do I set this default and how
> > > would I do this?
>
> > > I've tried to figure it out on my own but i've gotten nowhere
>
> > > Thanks!
>
> > In the view, when you instantiate the form, you can pass a dictionary
> > of initial values, which you can populate from the session:
>
> > initial_data = {'user_id': request.user.id }
> > form = MyModelForm(initial=initial_data)
>
> > --
> > DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Working with Forms and Session Variables

2009-02-11 Thread gbd

Thanks!

A follow up question -

Would i exclude that field in my class description?
i.e.

class RecipeForm(forms.ModelForm):
class Meta:
model = Recipes
exclude = ('user',)

On Feb 11, 10:54 am, Daniel Roseman <roseman.dan...@googlemail.com>
wrote:
> On Feb 11, 3:20 pm, gbd <ganit.bar...@gmail.com> wrote:
>
>
>
> > Hello,
>
> > I am presently working on my first Django project and seemed to be a
> > little stuck concerning session variables and forms.
>
> > This is how my app is laid out:
> > - user logs in and is directed to a "you have successfully logged in"
> > page
> > - user is then redirected to what i am hoping to be an account page
> > where they can submit information using a form
> > - this form is a ModelForm (which I believe makes a difference)
> > - since the user has already logged in I would like the user field on
> > this form to be defaulted
>
> > This is where I am having trouble, where do I set this default and how
> > would I do this?
>
> > I've tried to figure it out on my own but i've gotten nowhere
>
> > Thanks!
>
> In the view, when you instantiate the form, you can pass a dictionary
> of initial values, which you can populate from the session:
>
> initial_data = {'user_id': request.user.id }
> form = MyModelForm(initial=initial_data)
>
> --
> DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Working with Forms and Session Variables

2009-02-11 Thread Daniel Roseman

On Feb 11, 3:20 pm, gbd <ganit.bar...@gmail.com> wrote:
> Hello,
>
> I am presently working on my first Django project and seemed to be a
> little stuck concerning session variables and forms.
>
> This is how my app is laid out:
> - user logs in and is directed to a "you have successfully logged in"
> page
> - user is then redirected to what i am hoping to be an account page
> where they can submit information using a form
> - this form is a ModelForm (which I believe makes a difference)
> - since the user has already logged in I would like the user field on
> this form to be defaulted
>
> This is where I am having trouble, where do I set this default and how
> would I do this?
>
> I've tried to figure it out on my own but i've gotten nowhere
>
> Thanks!

In the view, when you instantiate the form, you can pass a dictionary
of initial values, which you can populate from the session:

initial_data = {'user_id': request.user.id }
form = MyModelForm(initial=initial_data)

--
DR.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Working with Forms and Session Variables

2009-02-11 Thread gbd

Hello,

I am presently working on my first Django project and seemed to be a
little stuck concerning session variables and forms.

This is how my app is laid out:
- user logs in and is directed to a "you have successfully logged in"
page
- user is then redirected to what i am hoping to be an account page
where they can submit information using a form
- this form is a ModelForm (which I believe makes a difference)
- since the user has already logged in I would like the user field on
this form to be defaulted

This is where I am having trouble, where do I set this default and how
would I do this?

I've tried to figure it out on my own but i've gotten nowhere

Thanks!




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



Re: Session variables

2009-02-03 Thread Malcolm Tredinnick

On Tue, 2009-02-03 at 13:52 -0800, Vladimir Shulyak wrote:
> Any progress on this problem?
> I've got exactly the same problem with sessions on ubuntu/database-
> backend sessions. But the most interesting thing that variables like
> instances of large classes are deleted while simple instances like
> integers are fine.
> 
> class Cart():
> 
>   items = {}
>   totalPrice = 0
>   count = 0
>   company = 0
> 
> items variable holds a dictionary of objects (instances of
> models.Model), other variables are just integer objects. items var
> becomes empty after some time, other variables are ok. Seems like I am
> not allowed to hold model instances in session... But why?

Is it something special about model instances, or just anything that you
are setting in the dictionary? This sounds like it might just be a "deep
change" case, requiring you to manually mark the session as dirty (see
[1]).

Note that the following code will not save the data to the session
automatically:

def some_view(request, ...):
 request.session['cart'].items['foo'] = bar
 
 return ...

You haven't assigned anything to the session, so it doesn't get
automatically marked as dirty (you have updated something in place and
request.session has absolutely no way to know that). This is the same
situation as if you have ever used Python's various shelving modules.

Direct assignments to request.session result in automatic saving.
Updates in place to objects inside request.session require setting the
modified flag. It sounds like the situation you are describing might be
that case.

If not, again, the same request applies to you as to the original
poster: come up with a very small, self-contained example that
demonstrates the problem. We can't debug what we can't reproduce.


[1]
http://docs.djangoproject.com/en/dev/topics/http/sessions/#when-sessions-are-saved

Regards,
Malcolm


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



Re: Session variables

2009-02-03 Thread Vladimir Shulyak

Any progress on this problem?
I've got exactly the same problem with sessions on ubuntu/database-
backend sessions. But the most interesting thing that variables like
instances of large classes are deleted while simple instances like
integers are fine.

class Cart():

items = {}
totalPrice = 0
count = 0
company = 0

items variable holds a dictionary of objects (instances of
models.Model), other variables are just integer objects. items var
becomes empty after some time, other variables are ok. Seems like I am
not allowed to hold model instances in session... But why?

On Jan 9, 8:29 pm, bradders  wrote:
> No this is Linux (SUSE10), runing behind Apache and not filesystem.
>
> John
>
> On Jan 9, 1:27 am, Malcolm Tredinnick 
> wrote:
>
> > On Thu, 2009-01-08 at 05:12 -0800, bradders wrote:
> > > I will try to put something together.   I have a fairly detailed trace
> > > that I have put in thesessioncode that shows mysessionvariables
> > > are set when it calls one of my views, but the trace shows that the
> > > nextsessionsave only a newsessionvariable set in that view exists
> > > all the othersessionvariables have disappeared. I am not knowingly
> > > clearing the other variables.
>
> > By the way, are your using Windows by any chance and the
> > filesystem-basedsessionbackend? I remembered later last night that
> > there is one bug due to problems in the Windows filesystem (#9084).
>
> > Regards,
> > Malcolm

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



Re: Session Variables as Default Form Values

2009-02-02 Thread Ty

Ah, DURR. I just had to put "initial=" before the dictionary. Now it
all makes sense!

On Feb 2, 9:48 pm, Ty <brownellty...@gmail.com> wrote:
> Yes, but that would bound the data to the form and the data would try
> to be validated on page load. I'm looking to pass default values to an
> unbound form.
>
> On Jan 30, 7:13 pm, "Todd O'Bryan" <toddobr...@gmail.com> wrote:
>
> > You can pass data to a form class as a dictionary, so just save a
> > dictionary of the values in your session under some name that you'll
> > know to use.
>
> > On Fri, Jan 30, 2009 at 5:04 PM, Tyler Brownell <brownellty...@gmail.com> 
> > wrote:
> > >http://groups.google.com/group/django-users/browse_thread/thread/ed74...
>
> > > On Fri, Jan 30, 2009 at 5:03 PM, Ty <brownellty...@gmail.com> wrote:
>
> > >> I've went through the documentation for "modelforms" and "forms" but I
> > >> couldn't figure our how someone would set the default value for a form
> > >> field to a session variable.
>
> > >> I have a checkbox in my comment form that says "remember my
> > >> information". After a comment is submitted and if the checkbox is
> > >> checked I'm saving the persons name, email address, and website in
> > >> session variables.
>
> > >> Now I'm just trying to figure out how to get these session variables
> > >> to load as the default values in the form fields, if they exist.
>
> > >> Can anyone point me in the right direction?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Session Variables as Default Form Values

2009-02-02 Thread Ty

Yes, but that would bound the data to the form and the data would try
to be validated on page load. I'm looking to pass default values to an
unbound form.


On Jan 30, 7:13 pm, "Todd O'Bryan" <toddobr...@gmail.com> wrote:
> You can pass data to a form class as a dictionary, so just save a
> dictionary of the values in your session under some name that you'll
> know to use.
>
> On Fri, Jan 30, 2009 at 5:04 PM, Tyler Brownell <brownellty...@gmail.com> 
> wrote:
> >http://groups.google.com/group/django-users/browse_thread/thread/ed74...
>
> > On Fri, Jan 30, 2009 at 5:03 PM, Ty <brownellty...@gmail.com> wrote:
>
> >> I've went through the documentation for "modelforms" and "forms" but I
> >> couldn't figure our how someone would set the default value for a form
> >> field to a session variable.
>
> >> I have a checkbox in my comment form that says "remember my
> >> information". After a comment is submitted and if the checkbox is
> >> checked I'm saving the persons name, email address, and website in
> >> session variables.
>
> >> Now I'm just trying to figure out how to get these session variables
> >> to load as the default values in the form fields, if they exist.
>
> >> Can anyone point me in the right direction?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Session Variables as Default Form Values

2009-01-30 Thread Todd O'Bryan

You can pass data to a form class as a dictionary, so just save a
dictionary of the values in your session under some name that you'll
know to use.

On Fri, Jan 30, 2009 at 5:04 PM, Tyler Brownell <brownellty...@gmail.com> wrote:
> http://groups.google.com/group/django-users/browse_thread/thread/ed74391560c762bb
>
> On Fri, Jan 30, 2009 at 5:03 PM, Ty <brownellty...@gmail.com> wrote:
>>
>> I've went through the documentation for "modelforms" and "forms" but I
>> couldn't figure our how someone would set the default value for a form
>> field to a session variable.
>>
>> I have a checkbox in my comment form that says "remember my
>> information". After a comment is submitted and if the checkbox is
>> checked I'm saving the persons name, email address, and website in
>> session variables.
>>
>> Now I'm just trying to figure out how to get these session variables
>> to load as the default values in the form fields, if they exist.
>>
>> Can anyone point me in the right direction?
>
> >
>

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



Re: Session Variables as Default Form Values

2009-01-30 Thread Tyler Brownell
http://groups.google.com/group/django-users/browse_thread/thread/ed74391560c762bb

On Fri, Jan 30, 2009 at 5:03 PM, Ty <brownellty...@gmail.com> wrote:

> I've went through the documentation for "modelforms" and "forms" but I
> couldn't figure our how someone would set the default value for a form
> field to a session variable.
>
> I have a checkbox in my comment form that says "remember my
> information". After a comment is submitted and if the checkbox is
> checked I'm saving the persons name, email address, and website in
> session variables.
>
> Now I'm just trying to figure out how to get these session variables
> to load as the default values in the form fields, if they exist.
>
> Can anyone point me in the right direction?

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



Session Variables as Default Form Values

2009-01-30 Thread Ty

I've went through the documentation for "modelforms" and "forms" but I
couldn't figure our how someone would set the default value for a form
field to a session variable.

I have a checkbox in my comment form that says "remember my
information". After a comment is submitted and if the checkbox is
checked I'm saving the persons name, email address, and website in
session variables.

Now I'm just trying to figure out how to get these session variables
to load as the default values in the form fields, if they exist.

Can anyone point me in the right direction?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Session variables

2009-01-09 Thread bradders

No this is Linux (SUSE10), runing behind Apache and not filesystem.

John



On Jan 9, 1:27 am, Malcolm Tredinnick 
wrote:
> On Thu, 2009-01-08 at 05:12 -0800, bradders wrote:
> > I will try to put something together.   I have a fairly detailed trace
> > that I have put in thesessioncode that shows mysessionvariables
> > are set when it calls one of my views, but the trace shows that the
> > nextsessionsave only a newsessionvariable set in that view exists
> > all the othersessionvariables have disappeared. I am not knowingly
> > clearing the other variables.
>
> By the way, are your using Windows by any chance and the
> filesystem-basedsessionbackend? I remembered later last night that
> there is one bug due to problems in the Windows filesystem (#9084).
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Session variables

2009-01-08 Thread Malcolm Tredinnick

On Thu, 2009-01-08 at 05:12 -0800, bradders wrote:
> I will try to put something together.   I have a fairly detailed trace
> that I have put in the session code that shows my session variables
> are set when it calls one of my views, but the trace shows that the
> next session save only a new session variable set in that view exists
> all the other session variables have disappeared. I am not knowingly
> clearing the other variables.


By the way, are your using Windows by any chance and the
filesystem-based session backend? I remembered later last night that
there is one bug due to problems in the Windows filesystem (#9084).

Regards,
Malcolm



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



Re: Session variables

2009-01-08 Thread bradders

I will try to put something together.   I have a fairly detailed trace
that I have put in the session code that shows my session variables
are set when it calls one of my views, but the trace shows that the
next session save only a new session variable set in that view exists
all the other session variables have disappeared. I am not knowingly
clearing the other variables.
Thanks for your interest.
John

On Jan 8, 10:34 am, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Thu, 2009-01-08 at 02:30 -0800, bradders wrote:
> > Can anyone recommend a session system that works more reliably than
> > the built-in Django session handling?  I am finding that after calling
> > 2 or 3 different views the session variables that were stored at login
> > time get cleared. I am using django 1.0, but I think the problem
> > existed in earlier versions.
>
> Perhaps if you could provide a replicable test case we could look at
> whatever problem may exist in the Django system. To the best of my
> knowledge it doesn't just arbitrarily throw away variables, but there's
> not way to tell what you're doing from the description you've provided.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Session variables

2009-01-08 Thread Malcolm Tredinnick

On Thu, 2009-01-08 at 02:30 -0800, bradders wrote:
> Can anyone recommend a session system that works more reliably than
> the built-in Django session handling?  I am finding that after calling
> 2 or 3 different views the session variables that were stored at login
> time get cleared. I am using django 1.0, but I think the problem
> existed in earlier versions.

Perhaps if you could provide a replicable test case we could look at
whatever problem may exist in the Django system. To the best of my
knowledge it doesn't just arbitrarily throw away variables, but there's
not way to tell what you're doing from the description you've provided.

Regards,
Malcolm



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



Session variables

2009-01-08 Thread bradders

Can anyone recommend a session system that works more reliably than
the built-in Django session handling?  I am finding that after calling
2 or 3 different views the session variables that were stored at login
time get cleared. I am using django 1.0, but I think the problem
existed in earlier versions.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django Session Variables

2008-12-21 Thread j...@zigzap.com

Thanks

On Dec 20, 11:26 am, Jeff FW <jeff...@gmail.com> wrote:
> Looking 
> athttp://code.djangoproject.com/browser/django/trunk/django/contrib/aut...
> it doesn't look like it clears the session.  It *does* generate a new
> key, but that shouldn't affect anything.  It should only take you
> about two minutes to test it though--just try it out.
>
> -Jeff
>
> On Dec 19, 6:18 pm, "j...@zigzap.com" <jlb2...@gmail.com> wrote:
>
> > Does django maintain session variables when logging in or does it
> > generate a new session when you use the built in authentication.
> > Essentially I want to be able to assign session values to an Anonymous
> > User and be able to carry them through when they log in.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: del session variables

2008-12-20 Thread Jeff FW

Wow, you're right.  I've been programming Python for years, and I
somehow never noticed that.  I'll be quiet not :-)

On Dec 17, 6:33 pm, Malcolm Tredinnick 
wrote:
> On Wed, 2008-12-17 at 15:09 -0800, Jeff FW wrote:
> > You've got a space in between "HttpResponseRedirect" and "('../
> > shop')" .
>
> Which is perfectly legal and unambiguous in Python. That isn't a
> problem.
>
> Regards,
> Malcolm
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Django Session Variables

2008-12-20 Thread Jeff FW

Looking at
http://code.djangoproject.com/browser/django/trunk/django/contrib/auth/__init__.py#L46
it doesn't look like it clears the session.  It *does* generate a new
key, but that shouldn't affect anything.  It should only take you
about two minutes to test it though--just try it out.

-Jeff

On Dec 19, 6:18 pm, "j...@zigzap.com" <jlb2...@gmail.com> wrote:
> Does django maintain session variables when logging in or does it
> generate a new session when you use the built in authentication.
> Essentially I want to be able to assign session values to an Anonymous
> User and be able to carry them through when they log in.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Django Session Variables

2008-12-19 Thread j...@zigzap.com

Does django maintain session variables when logging in or does it
generate a new session when you use the built in authentication.
Essentially I want to be able to assign session values to an Anonymous
User and be able to carry them through when they log in.
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: del session variables

2008-12-17 Thread Malcolm Tredinnick


On Wed, 2008-12-17 at 15:09 -0800, Jeff FW wrote:
> You've got a space in between "HttpResponseRedirect" and "('../
> shop')" .

Which is perfectly legal and unambiguous in Python. That isn't a
problem.

Regards,
Malcolm



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



Re: del session variables

2008-12-17 Thread Malcolm Tredinnick


On Wed, 2008-12-17 at 11:44 -0800, Bobby Roberts wrote:
> 
> > Have a look at theflush() method; I believe that might well be close to
> > what you are after.
> >
> > Regards,
> > Malcolm
> 
> 
> I'm trying to call the view below:
> 
> def DoSessionReset(request):
> request.session.flush()
> return HttpResponseRedirect ('../shop')
> 
> 
> I'm getting this error:
> 
> TypeError at /shop/start-new-order/
> 'str' object is not callable

You're getting a lot more than that, though. You're getting a full
tracreback that tells you where the problem is occurring, for a start.

Also, if the problem really is triggered by request.session being a
string, then something else is going wrong, since Django's session
middleware will never be setting it to a string.

So help us to help you here: give us the full traceback and try to work
out *what* is a string (and what the value of that string is) that is
being passed in unexpectedly.

Regards,
Malcolm



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



Re: del session variables

2008-12-17 Thread Jeff FW

You've got a space in between "HttpResponseRedirect" and "('../
shop')" .

On Dec 17, 2:44 pm, Bobby Roberts  wrote:
> > Have a look at theflush() method; I believe that might well be close to
> > what you are after.
>
> > Regards,
> > Malcolm
>
> I'm trying to call the view below:
>
> def DoSessionReset(request):
>     request.session.flush()
>     return HttpResponseRedirect ('../shop')
>
> I'm getting this error:
>
> TypeError at /shop/start-new-order/
> 'str' object is not callable
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: del session variables

2008-12-17 Thread Bobby Roberts


> Have a look at theflush() method; I believe that might well be close to
> what you are after.
>
> Regards,
> Malcolm


I'm trying to call the view below:

def DoSessionReset(request):
request.session.flush()
return HttpResponseRedirect ('../shop')


I'm getting this error:

TypeError at /shop/start-new-order/
'str' object is not callable



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



Re: del session variables

2008-11-20 Thread Malcolm Tredinnick


On Thu, 2008-11-20 at 14:06 -0800, Bobby Roberts wrote:
> is there a way to kill a session rather than running a del statement
> on each session variable?  I know in .asp you can simply say
> session.abandon.  Is there an equivalent with django?

Django has this really nifty feature (I believe ASP.NET has it too)
called "documentation". If you look at the documentation for the
sessions application, there's this section:

http://docs.djangoproject.com/en/dev/topics/http/sessions/#using-sessions-in-views

Have a look at the flush() method; I believe that might well be close to
what you are after.

Regards,
Malcolm


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: del session variables

2008-11-20 Thread Andy McKay

On 20 Nov 2008, at 22:06, Bobby Roberts wrote:
> is there a way to kill a session rather than running a del statement
> on each session variable?  I know in .asp you can simply say
> session.abandon.  Is there an equivalent with django?


In the session documentation there are mentions of: clear() and flush()

http://docs.djangoproject.com/en/dev/topics/http/sessions/#topics-http-sessions

Sounds like one of those might be helpful.
--
   Andy McKay
   Clearwind Consulting

   Site: www.clearwind.ca
   Blog: www.agmweb.ca/blog/andy






--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



del session variables

2008-11-20 Thread Bobby Roberts

is there a way to kill a session rather than running a del statement
on each session variable?  I know in .asp you can simply say
session.abandon.  Is there an equivalent with django?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: intial form field values using session variables

2008-06-27 Thread Arien

On Fri, Jun 27, 2008 at 1:12 PM, Bobby Roberts <[EMAIL PROTECTED]> wrote:
>
> [...] I'm trying to print those session variables to the screen in
> step 2 (ie the 2nd form) so the user can review what was previously
> entered on the first fom.

(If this page immediately follows the first page, you could of course
take the values for the request itself.)

> as an old ASP programmer when we wanted to just print a session
> variable we'd code:
>
> <%=session("whatever")%>
>
> What is the django equiv?
>
> I'm trying this:
>
> {{request.session["whatever"] }}
>
> but it says it can't parse the remainder...

Use the syntax of Django's template language:

{{ request.session.whatever }}


Arien

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: intial form field values using session variables

2008-06-27 Thread Bobby Roberts

> You can pass in an "initial" argument when you instantiate your Form,
> as explained 
> here:http://www.djangoproject.com/documentation/newforms/#dynamic-initial-...
>
> Arien

cool!  I overlooked that.  I've got it working great.  I'm trying to
print those session variables to the screen in step 2 (ie the 2nd
form) so the user can review what was previously entered on the first
fom.

as an old ASP programmer when we wanted to just print a session
variable we'd code:

<%=session("whatever")%>

What is the django equiv?

I'm trying this:

{{request.session["whatever"] }}

but it says it can't parse the remainder...


BR
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: intial form field values using session variables

2008-06-27 Thread Arien

On Fri, Jun 27, 2008 at 8:42 AM, Bobby Roberts <[EMAIL PROTECTED]> wrote:
>
> i'm trying to use session variables as initial values for certain form
> fields as such:
>
>AccountNum = forms.CharField
> (initial=request.session["AccountNum"],max_length=20, required=True,
> label = "Account #")
>
> i'm getting this:
>
> NameError: name 'request' is not defined
>
>
> how do i use a session variable for initial data?

You can pass in an "initial" argument when you instantiate your Form,
as explained here:
http://www.djangoproject.com/documentation/newforms/#dynamic-initial-values


Arien

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



intial form field values using session variables

2008-06-27 Thread Bobby Roberts

i'm trying to use session variables as initial values for certain form
fields as such:

AccountNum = forms.CharField
(initial=request.session["AccountNum"],max_length=20, required=True,
label = "Account #")

i'm getting this:

NameError: name 'request' is not defined


how do i use a session variable for initial data?


BR
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Session variables without a database

2007-11-07 Thread [EMAIL PROTECTED]

Thanks...

On Nov 7, 8:15 pm, "@@" <[EMAIL PROTECTED]> wrote:
> Configuring the session engine
>
> *New in development version*.
>
> By default, Django stores sessions in your database (using the model
> django.contrib.sessions.models.Session). Though this is convenient, in some
> setups it's faster to store session data elsewhere, so Django can be
> configured to store session data on your filesystem or in your cache.
>  Using file-based sessions
>
> To use file-based sessions, set the SESSION_ENGINE setting to "
> django.contrib.sessions.backends.file".
>
> You might also want to set the SESSION_FILE_PATH setting (which defaults to
> /tmp) to control where Django stores session files. Be sure to check that
> your Web server has permissions to read and write to this location.
>
> On 11/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
>
> > I need to put together a small site for some demos...I don't need a
> > database as I'm getting my data via some API calls,  but wanted to use
> > Django templates.   I had wanted to store this data in a session
> > variable ( the API calls can take a while)... I thought I remembered
> > reading somewhere it wasn't possible to use session variables w/out
> > using a Database with Django.  Anyone have any work arounds for
> > this?
>
> > Thanks for any info.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Session variables without a database

2007-11-07 Thread @@
Configuring the session engine

*New in development version*.

By default, Django stores sessions in your database (using the model
django.contrib.sessions.models.Session). Though this is convenient, in some
setups it's faster to store session data elsewhere, so Django can be
configured to store session data on your filesystem or in your cache.
 Using file-based sessions

To use file-based sessions, set the SESSION_ENGINE setting to "
django.contrib.sessions.backends.file".

You might also want to set the SESSION_FILE_PATH setting (which defaults to
/tmp) to control where Django stores session files. Be sure to check that
your Web server has permissions to read and write to this location.


On 11/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>
> I need to put together a small site for some demos...I don't need a
> database as I'm getting my data via some API calls,  but wanted to use
> Django templates.   I had wanted to store this data in a session
> variable ( the API calls can take a while)... I thought I remembered
> reading somewhere it wasn't possible to use session variables w/out
> using a Database with Django.  Anyone have any work arounds for
> this?
>
> Thanks for any info.
>
>
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Session variables without a database

2007-11-07 Thread [EMAIL PROTECTED]

I need to put together a small site for some demos...I don't need a
database as I'm getting my data via some API calls,  but wanted to use
Django templates.   I had wanted to store this data in a session
variable ( the API calls can take a while)... I thought I remembered
reading somewhere it wasn't possible to use session variables w/out
using a Database with Django.  Anyone have any work arounds for
this?

Thanks for any info.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious error with Session Variables

2007-05-10 Thread Diego pylorca
Thanks Graham :)

it works!!

On 5/9/07, Graham Dumpleton <[EMAIL PROTECTED]> wrote:
>
>
> Try reenabling PHP, but delve into the PHP setup and disable the
> loading of the PHP mhash module first.
>
> There have been cases where the PHP mhash module has clashed in some
> way with the Python md5 hash modules and caused the Python module to
> give back incorrect results. This may have an effect on session
> cookies if a md5 hash is used in some way to generate it.
>
> Graham
>
> On May 9, 11:16 pm, "Diego pylorca" <[EMAIL PROTECTED]> wrote:
> > Nop,
> >
> > when I disable mod-php5, the admin works correctly :(
> >
> > my web browsers are firefox and opera and IE, but it is not a client
> host
> > problem :'(
> >
> > On 5/8/07, John DeRosa <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> >
> > > Perhaps check your firewall, anti-hijack, anti-trojan, etc. software.
> > > You may have a cookie guard enabled.
> >
> > > For example, Webroot's Spy Sweeper has a set of "shields" for web
> > > browsers, and they include the blocking of certain tracking cookies
> and
> > > some IE security 'protection'.  Perhaps your system is running a
> similar
> > > product?
> >
> > > John
> >
> > > Diego pylorca wrote:
> > > > m
> >
> > > > I deployed my site, and in the admin when i try to login i get this
> > > message:
> >
> > > > "Looks like your browser isn't configured to accept cookies. Please
> > > > enable cookies, reload this page, and try again."
> >
> > > > the cookies is enabled.
> >
> > > > my server is a debian etch stable (intalled modpython apache2 and
> mysql
> > > > from apt)
> >
> > > > i ve run django/bin/daily_cleanup.py and flush the session table...
> >
> > > > PD: sory by me bad english
> >
> > > > On 4/4/07, *chasfs* <[EMAIL PROTECTED] >
> wrote:
> >
> > > > There are several things going on here. If you have multiple
> django
> > > > sites
> > > > all setting sessions cookies, make sure that the
> SESSION_COOKIE_NAME
> > > > and SESSION_COOKIE_DOMAIN are unique in the respective
> settings.py
> > > > files.
> >
> > > > You also need to clean out old session rows in the
> django_session
> > > > database.
> > > > You can use django/bin/daily_cleanup.py to do this.
> >
> > > > Good luck,
> > > > -chasfs
> >
> > > > On Apr 3, 1:36 pm, "Ramdas S" < [EMAIL PROTECTED]
> > > > > wrote:
> > > >  > Since last few days I am getting this error on Django web
> sites
> > > > hosted.
> > > >  > Obviously it is clashing with something.
> >
> > > >  > When I work on admin interface to add or delete content, I
> get
> > > > logged off
> > > >  > and it takes some time for me to login again.
> >
> > > >  > I get the following messages
> >
> > > >  > Please enter a correct username and password. Note that both
> > > > fields are
> > > >  > case-sensitive.
> >
> > > >  > If I keep on trying then the message changes to
> >
> > > >  > Looks like your browser isn't configured to accept cookies.
> > > > Please enable
> > > >  > cookies, reload this page, and try again.
> >
> > > >  > Later if I persist
> >
> > > >  > I get this error
> >
> > > >  > -
> >
> > > >  > SuspiciousOperation at /admin/ User may have tampered with
> > > session
> > > >  > cookie. Request
> > > >  > Method: POST  Request URL:http://developeriq.com/admin/
> > > > Exception Type:
> > > >  > SuspiciousOperation  Exception Value: User may have tampered
> with
> > > > session
> > > >  > cookie.  Exception Location:
> >
> > >
> /usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
> >
> > > >  > in _decode_post_data, line 40
> >
> > > >  > I am using the latest development version Mod_Python, Apache
> and
> > > > Ubuntu
> > > >  > Linux
> >
> > > >  > What can be the reason
> >
> > > >  > Thanks
> >
> > > >  > Ramdas S
> >
> > > >  > The Server is a dedicated server, and it also runs PHP, MySQl
> and
> > > > some PHP
> > > >  > and Python software.
> >
> > > > --
> > > > Diego F. Toritto.
> >
> > --
> > Diego F. Toritto.
>
>
> >
>


-- 
Diego F. Toritto.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious error with Session Variables

2007-05-09 Thread Graham Dumpleton

Try reenabling PHP, but delve into the PHP setup and disable the
loading of the PHP mhash module first.

There have been cases where the PHP mhash module has clashed in some
way with the Python md5 hash modules and caused the Python module to
give back incorrect results. This may have an effect on session
cookies if a md5 hash is used in some way to generate it.

Graham

On May 9, 11:16 pm, "Diego pylorca" <[EMAIL PROTECTED]> wrote:
> Nop,
>
> when I disable mod-php5, the admin works correctly :(
>
> my web browsers are firefox and opera and IE, but it is not a client host
> problem :'(
>
> On 5/8/07, John DeRosa <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Perhaps check your firewall, anti-hijack, anti-trojan, etc. software.
> > You may have a cookie guard enabled.
>
> > For example, Webroot's Spy Sweeper has a set of "shields" for web
> > browsers, and they include the blocking of certain tracking cookies and
> > some IE security 'protection'.  Perhaps your system is running a similar
> > product?
>
> > John
>
> > Diego pylorca wrote:
> > > m
>
> > > I deployed my site, and in the admin when i try to login i get this
> > message:
>
> > > "Looks like your browser isn't configured to accept cookies. Please
> > > enable cookies, reload this page, and try again."
>
> > > the cookies is enabled.
>
> > > my server is a debian etch stable (intalled modpython apache2 and mysql
> > > from apt)
>
> > > i ve run django/bin/daily_cleanup.py and flush the session table...
>
> > > PD: sory by me bad english
>
> > > On 4/4/07, *chasfs* <[EMAIL PROTECTED] > wrote:
>
> > > There are several things going on here. If you have multiple django
> > > sites
> > > all setting sessions cookies, make sure that the SESSION_COOKIE_NAME
> > > and SESSION_COOKIE_DOMAIN are unique in the respective settings.py
> > > files.
>
> > > You also need to clean out old session rows in the django_session
> > > database.
> > > You can use django/bin/daily_cleanup.py to do this.
>
> > > Good luck,
> > > -chasfs
>
> > > On Apr 3, 1:36 pm, "Ramdas S" < [EMAIL PROTECTED]
> > > > wrote:
> > >  > Since last few days I am getting this error on Django web sites
> > > hosted.
> > >  > Obviously it is clashing with something.
>
> > >  > When I work on admin interface to add or delete content, I get
> > > logged off
> > >  > and it takes some time for me to login again.
>
> > >  > I get the following messages
>
> > >  > Please enter a correct username and password. Note that both
> > > fields are
> > >  > case-sensitive.
>
> > >  > If I keep on trying then the message changes to
>
> > >  > Looks like your browser isn't configured to accept cookies.
> > > Please enable
> > >  > cookies, reload this page, and try again.
>
> > >  > Later if I persist
>
> > >  > I get this error
>
> > >  > -
>
> > >  > SuspiciousOperation at /admin/ User may have tampered with
> > session
> > >  > cookie. Request
> > >  > Method: POST  Request URL:http://developeriq.com/admin/
> > > Exception Type:
> > >  > SuspiciousOperation  Exception Value: User may have tampered with
> > > session
> > >  > cookie.  Exception Location:
>
> > /usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
>
> > >  > in _decode_post_data, line 40
>
> > >  > I am using the latest development version Mod_Python, Apache and
> > > Ubuntu
> > >  > Linux
>
> > >  > What can be the reason
>
> > >  > Thanks
>
> > >  > Ramdas S
>
> > >  > The Server is a dedicated server, and it also runs PHP, MySQl and
> > > some PHP
> > >  > and Python software.
>
> > > --
> > > Diego F. Toritto.
>
> --
> Diego F. Toritto.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious error with Session Variables

2007-05-09 Thread Diego pylorca
Nop,

when I disable mod-php5, the admin works correctly :(

my web browsers are firefox and opera and IE, but it is not a client host
problem :'(

On 5/8/07, John DeRosa <[EMAIL PROTECTED]> wrote:
>
>
> Perhaps check your firewall, anti-hijack, anti-trojan, etc. software.
> You may have a cookie guard enabled.
>
> For example, Webroot's Spy Sweeper has a set of "shields" for web
> browsers, and they include the blocking of certain tracking cookies and
> some IE security 'protection'.  Perhaps your system is running a similar
> product?
>
> John
>
> Diego pylorca wrote:
> > m
> >
> > I deployed my site, and in the admin when i try to login i get this
> message:
> >
> > "Looks like your browser isn't configured to accept cookies. Please
> > enable cookies, reload this page, and try again."
> >
> > the cookies is enabled.
> >
> > my server is a debian etch stable (intalled modpython apache2 and mysql
> > from apt)
> >
> > i ve run django/bin/daily_cleanup.py and flush the session table...
> >
> >
> > PD: sory by me bad english
> >
> >
> > On 4/4/07, *chasfs* <[EMAIL PROTECTED] > wrote:
> >
> >
> > There are several things going on here. If you have multiple django
> > sites
> > all setting sessions cookies, make sure that the SESSION_COOKIE_NAME
> > and SESSION_COOKIE_DOMAIN are unique in the respective settings.py
> > files.
> >
> > You also need to clean out old session rows in the django_session
> > database.
> > You can use django/bin/daily_cleanup.py to do this.
> >
> > Good luck,
> > -chasfs
> >
> > On Apr 3, 1:36 pm, "Ramdas S" < [EMAIL PROTECTED]
> > > wrote:
> >  > Since last few days I am getting this error on Django web sites
> > hosted.
> >  > Obviously it is clashing with something.
> >  >
> >  > When I work on admin interface to add or delete content, I get
> > logged off
> >  > and it takes some time for me to login again.
> >  >
> >  > I get the following messages
> >  >
> >  > Please enter a correct username and password. Note that both
> > fields are
> >  > case-sensitive.
> >  >
> >  > If I keep on trying then the message changes to
> >  >
> >  > Looks like your browser isn't configured to accept cookies.
> > Please enable
> >  > cookies, reload this page, and try again.
> >  >
> >  > Later if I persist
> >  >
> >  > I get this error
> >  >
> >  > -
> >  >
> >  > SuspiciousOperation at /admin/ User may have tampered with
> session
> >  > cookie. Request
> >  > Method: POST  Request URL: http://developeriq.com/admin/
> > Exception Type:
> >  > SuspiciousOperation  Exception Value: User may have tampered with
> > session
> >  > cookie.  Exception Location:
> >  >
> >
> /usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
> >
> >  > in _decode_post_data, line 40
> >  >
> >  > I am using the latest development version Mod_Python, Apache and
> > Ubuntu
> >  > Linux
> >  >
> >  > What can be the reason
> >  >
> >  > Thanks
> >  >
> >  > Ramdas S
> >  >
> >  > The Server is a dedicated server, and it also runs PHP, MySQl and
> > some PHP
> >  > and Python software.
> >
> >
> >
> >
> >
> >
> >
> > --
> > Diego F. Toritto.
> > >
>
>
> >
>


-- 
Diego F. Toritto.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious error with Session Variables

2007-05-08 Thread John DeRosa

Perhaps check your firewall, anti-hijack, anti-trojan, etc. software. 
You may have a cookie guard enabled.

For example, Webroot's Spy Sweeper has a set of "shields" for web 
browsers, and they include the blocking of certain tracking cookies and 
some IE security 'protection'.  Perhaps your system is running a similar 
product?

John

Diego pylorca wrote:
> m
> 
> I deployed my site, and in the admin when i try to login i get this message:
> 
> "Looks like your browser isn't configured to accept cookies. Please 
> enable cookies, reload this page, and try again."
> 
> the cookies is enabled.
> 
> my server is a debian etch stable (intalled modpython apache2 and mysql 
> from apt)
> 
> i ve run django/bin/daily_cleanup.py and flush the session table...
> 
> 
> PD: sory by me bad english
> 
> 
> On 4/4/07, *chasfs* <[EMAIL PROTECTED] > wrote:
> 
> 
> There are several things going on here. If you have multiple django
> sites
> all setting sessions cookies, make sure that the SESSION_COOKIE_NAME
> and SESSION_COOKIE_DOMAIN are unique in the respective settings.py
> files.
> 
> You also need to clean out old session rows in the django_session
> database.
> You can use django/bin/daily_cleanup.py to do this.
> 
> Good luck,
> -chasfs
> 
> On Apr 3, 1:36 pm, "Ramdas S" < [EMAIL PROTECTED]
> > wrote:
>  > Since last few days I am getting this error on Django web sites
> hosted.
>  > Obviously it is clashing with something.
>  >
>  > When I work on admin interface to add or delete content, I get
> logged off
>  > and it takes some time for me to login again.
>  >
>  > I get the following messages
>  >
>  > Please enter a correct username and password. Note that both
> fields are
>  > case-sensitive.
>  >
>  > If I keep on trying then the message changes to
>  >
>  > Looks like your browser isn't configured to accept cookies.
> Please enable
>  > cookies, reload this page, and try again.
>  >
>  > Later if I persist
>  >
>  > I get this error
>  >
>  > -
>  >
>  > SuspiciousOperation at /admin/ User may have tampered with session
>  > cookie. Request
>  > Method: POST  Request URL: http://developeriq.com/admin/
> Exception Type:
>  > SuspiciousOperation  Exception Value: User may have tampered with
> session
>  > cookie.  Exception Location:
>  >
> /usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
> 
>  > in _decode_post_data, line 40
>  >
>  > I am using the latest development version Mod_Python, Apache and
> Ubuntu
>  > Linux
>  >
>  > What can be the reason
>  >
>  > Thanks
>  >
>  > Ramdas S
>  >
>  > The Server is a dedicated server, and it also runs PHP, MySQl and
> some PHP
>  > and Python software.
> 
> 
> 
> 
> 
> 
> 
> -- 
> Diego F. Toritto.
> > 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious error with Session Variables

2007-05-08 Thread Diego pylorca
m

I deployed my site, and in the admin when i try to login i get this message:

"Looks like your browser isn't configured to accept cookies. Please enable
cookies, reload this page, and try again."

the cookies is enabled.

my server is a debian etch stable (intalled modpython apache2 and mysql from
apt)

i ve run django/bin/daily_cleanup.py and flush the session table...


PD: sory by me bad english


On 4/4/07, chasfs <[EMAIL PROTECTED]> wrote:
>
>
> There are several things going on here. If you have multiple django
> sites
> all setting sessions cookies, make sure that the SESSION_COOKIE_NAME
> and SESSION_COOKIE_DOMAIN are unique in the respective settings.py
> files.
>
> You also need to clean out old session rows in the django_session
> database.
> You can use django/bin/daily_cleanup.py to do this.
>
> Good luck,
> -chasfs
>
> On Apr 3, 1:36 pm, "Ramdas S" <[EMAIL PROTECTED]> wrote:
> > Since last few days I am getting this error on Django web sites hosted.
> > Obviously it is clashing with something.
> >
> > When I work on admin interface to add or delete content, I get logged
> off
> > and it takes some time for me to login again.
> >
> > I get the following messages
> >
> > Please enter a correct username and password. Note that both fields are
> > case-sensitive.
> >
> > If I keep on trying then the message changes to
> >
> > Looks like your browser isn't configured to accept cookies. Please
> enable
> > cookies, reload this page, and try again.
> >
> > Later if I persist
> >
> > I get this error
> >
> > -
> >
> > SuspiciousOperation at /admin/ User may have tampered with session
> > cookie. Request
> > Method: POST  Request URL:http://developeriq.com/admin/ Exception Type:
> > SuspiciousOperation  Exception Value: User may have tampered with
> session
> > cookie.  Exception Location:
> >
> /usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
> > in _decode_post_data, line 40
> >
> > I am using the latest development version Mod_Python, Apache and Ubuntu
> > Linux
> >
> > What can be the reason
> >
> > Thanks
> >
> > Ramdas S
> >
> > The Server is a dedicated server, and it also runs PHP, MySQl and some
> PHP
> > and Python software.
>
>
> >
>


-- 
Diego F. Toritto.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious error with Session Variables

2007-05-08 Thread Diego pylorca
For more info about me config:

Apache/2.2.3 (Debian) mod_python/3.2.10 Python/2.4.4 PHP/5.2.0-8+etch3
mod_ssl/2.2.3 OpenSSL/0.9.8c Server at *** Port 80

and my vhost:


ServerName ***.net
ServerAlias www..net
CustomLog /var/log/apache2/***/access.log combined
PythonPath "['/var/www/***/', '/usr/src/django/Django-0.96/'] +
sys.path"
SetHandler python-program
PythonHandler django.core.handlers.modpython
PythonDebug Off

# para que no haga falta restartear el apache
#PythonAutoreload On

SetEnv DJANGO_SETTINGS_MODULE pvs.settings
PythonInterpreter **_main

Alias /media /var/www/***/pvs/media

   SetHandler None




Thanks

On 5/8/07, Diego pylorca <[EMAIL PROTECTED]> wrote:
>
> m
>
> I deployed my site, and in the admin when i try to login i get this
> message:
>
> "Looks like your browser isn't configured to accept cookies. Please enable
> cookies, reload this page, and try again."
>
> the cookies is enabled.
>
> my server is a debian etch stable (intalled modpython apache2 and mysql
> from apt)
>
> i ve run django/bin/daily_cleanup.py and flush the session table...
>
>
> PD: sory by me bad english
>
>
> On 4/4/07, chasfs <[EMAIL PROTECTED]> wrote:
> >
> >
> > There are several things going on here. If you have multiple django
> > sites
> > all setting sessions cookies, make sure that the SESSION_COOKIE_NAME
> > and SESSION_COOKIE_DOMAIN are unique in the respective settings.py
> > files.
> >
> > You also need to clean out old session rows in the django_session
> > database.
> > You can use django/bin/daily_cleanup.py to do this.
> >
> > Good luck,
> > -chasfs
> >
> > On Apr 3, 1:36 pm, "Ramdas S" < [EMAIL PROTECTED]> wrote:
> > > Since last few days I am getting this error on Django web sites
> > hosted.
> > > Obviously it is clashing with something.
> > >
> > > When I work on admin interface to add or delete content, I get logged
> > off
> > > and it takes some time for me to login again.
> > >
> > > I get the following messages
> > >
> > > Please enter a correct username and password. Note that both fields
> > are
> > > case-sensitive.
> > >
> > > If I keep on trying then the message changes to
> > >
> > > Looks like your browser isn't configured to accept cookies. Please
> > enable
> > > cookies, reload this page, and try again.
> > >
> > > Later if I persist
> > >
> > > I get this error
> > >
> > > -
> > >
> > > SuspiciousOperation at /admin/ User may have tampered with session
> > > cookie. Request
> > > Method: POST  Request URL: http://developeriq.com/admin/ Exception
> > Type:
> > > SuspiciousOperation  Exception Value: User may have tampered with
> > session
> > > cookie.  Exception Location:
> > >
> > /usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
> > > in _decode_post_data, line 40
> > >
> > > I am using the latest development version Mod_Python, Apache and
> > Ubuntu
> > > Linux
> > >
> > > What can be the reason
> > >
> > > Thanks
> > >
> > > Ramdas S
> > >
> > > The Server is a dedicated server, and it also runs PHP, MySQl and some
> > PHP
> > > and Python software.
> >
> >
> > > >
> >
>
>
> --
> Diego F. Toritto.




-- 
Diego F. Toritto.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious error with Session Variables

2007-04-04 Thread chasfs

There are several things going on here. If you have multiple django
sites
all setting sessions cookies, make sure that the SESSION_COOKIE_NAME
and SESSION_COOKIE_DOMAIN are unique in the respective settings.py
files.

You also need to clean out old session rows in the django_session
database.
You can use django/bin/daily_cleanup.py to do this.

Good luck,
-chasfs

On Apr 3, 1:36 pm, "Ramdas S" <[EMAIL PROTECTED]> wrote:
> Since last few days I am getting this error on Django web sites hosted.
> Obviously it is clashing with something.
>
> When I work on admin interface to add or delete content, I get logged off
> and it takes some time for me to login again.
>
> I get the following messages
>
> Please enter a correct username and password. Note that both fields are
> case-sensitive.
>
> If I keep on trying then the message changes to
>
> Looks like your browser isn't configured to accept cookies. Please enable
> cookies, reload this page, and try again.
>
> Later if I persist
>
> I get this error
>
> -
>
> SuspiciousOperation at /admin/ User may have tampered with session
> cookie. Request
> Method: POST  Request URL:http://developeriq.com/admin/ Exception Type:
> SuspiciousOperation  Exception Value: User may have tampered with session
> cookie.  Exception Location:
> /usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
> in _decode_post_data, line 40
>
> I am using the latest development version Mod_Python, Apache and Ubuntu
> Linux
>
> What can be the reason
>
> Thanks
>
> Ramdas S
>
> The Server is a dedicated server, and it also runs PHP, MySQl and some PHP
> and Python software.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious error with Session Variables

2007-04-03 Thread Kenneth Gonsalves


On 03-Apr-07, at 11:06 PM, Ramdas S wrote:

> Looks like your browser isn't configured to accept cookies. Please  
> enable cookies, reload this page, and try again.
>
>
> Later if I persist
>
> I get this error

one person on irc was getting this - he solved it by physically  
restarting apache - he was relying on the autoreload of mod_python

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/web/



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Curious error with Session Variables

2007-04-03 Thread Ramdas S
browsing through the user groups, I see that the issue is a clash between
Django and PHP4/5. I cannot turn them off, since some sites on our server
still use PHP. Is there any solution where we can ensure that Django does
not clash with PHP and live peacefully.

I am eager to know

Ramdas

On 4/3/07, Ramdas S <[EMAIL PROTECTED]> wrote:
>
> Since last few days I am getting this error on Django web sites hosted.
> Obviously it is clashing with something.
>
> When I work on admin interface to add or delete content, I get logged off
> and it takes some time for me to login again.
>
> I get the following messages
>
> Please enter a correct username and password. Note that both fields are
> case-sensitive.
>
> If I keep on trying then the message changes to
>
> Looks like your browser isn't configured to accept cookies. Please enable
> cookies, reload this page, and try again.
>
>
> Later if I persist
>
> I get this error
>
> -
>
> SuspiciousOperation at /admin/ User may have tampered with session cookie. 
> Request
> Method: POST  Request URL: http://developeriq.com/admin/  Exception Type:
> SuspiciousOperation  Exception Value: User may have tampered with session
> cookie.  Exception Location: 
> /usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
> in _decode_post_data, line 40
>
>
>
>
>
> I am using the latest development version Mod_Python, Apache and Ubuntu
> Linux
>
> What can be the reason
>
>
>
> Thanks
>
>
> Ramdas S
>
> The Server is a dedicated server, and it also runs PHP, MySQl and some PHP
> and Python software.
>
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Curious error with Session Variables

2007-04-03 Thread Ramdas S
Since last few days I am getting this error on Django web sites hosted.
Obviously it is clashing with something.

When I work on admin interface to add or delete content, I get logged off
and it takes some time for me to login again.

I get the following messages

Please enter a correct username and password. Note that both fields are
case-sensitive.

If I keep on trying then the message changes to

Looks like your browser isn't configured to accept cookies. Please enable
cookies, reload this page, and try again.


Later if I persist

I get this error

-

SuspiciousOperation at /admin/ User may have tampered with session
cookie. Request
Method: POST  Request URL: http://developeriq.com/admin/  Exception Type:
SuspiciousOperation  Exception Value: User may have tampered with session
cookie.  Exception Location:
/usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py
in _decode_post_data, line 40





I am using the latest development version Mod_Python, Apache and Ubuntu
Linux

What can be the reason



Thanks


Ramdas S

The Server is a dedicated server, and it also runs PHP, MySQl and some PHP
and Python software.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Accessing session variables in templates

2006-10-12 Thread patrickk

I didn´t try that, but with a combination of the following it should  
work:

http://www.djangoproject.com/documentation/request_response/#attributes
http://www.djangoproject.com/documentation/templates_python/#django- 
core-context-processors-request

patrick


Am 12.10.2006 um 19:21 schrieb Patrick J. Anderson:

>
> Hi!
>
> I have a member_id session variable, which I set at login (it is
> different than "user").
>
> I need to check that variable in my templates to display member- 
> specific
> navigation.
>
> How can I check do this? Or do I need to do the checking in each view
> function and pass the value in a template variable?
>
> Regards, Patrick
>
>
> >


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---



Accessing session variables in templates

2006-10-12 Thread Patrick J. Anderson

Hi!

I have a member_id session variable, which I set at login (it is 
different than "user").

I need to check that variable in my templates to display member-specific 
navigation.

How can I check do this? Or do I need to do the checking in each view 
function and pass the value in a template variable?

Regards, Patrick


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~--~~~~--~~--~--~---