How to use django login_required decorator for custom authentication backend?

2020-06-07 Thread reasm
Hi, I have created an authentication backend that allows users to login using their username, password and institute id. Although the user can login but it doesn’t get access to the view with login_required decor. When I login to the site it redirects to this url: ' http://xxx.xx.xx.x

Re: login_required decorator in Django: open modal instead of redirecting to another page

2015-04-13 Thread Avraham Serour
ch has certain sections which are reserved for >> registered users. I have the views annotated with login_required decorator >> which redirects the user to a login page. >> >> However, I would like to keep the user on the same page and open up a >> modal dialog prompti

Re: login_required decorator in Django: open modal instead of redirecting to another page

2015-04-13 Thread Roh Codeur
I ended up going with Avraham's response in this. On Thursday, 9 April 2015 01:53:35 UTC+1, Roh Codeur wrote: > > Hi > > I have a django app which has certain sections which are reserved for > registered users. I have the views annotated with login_required decorator > w

Re: login_required decorator in Django: open modal instead of redirecting to another page

2015-04-09 Thread Avraham Serour
, 2015 at 10:25 PM, Roh Codeur wrote: > Hi > > I have a django app which has certain sections which are reserved for > registered users. I have the views annotated with login_required decorator > which redirects the user to a login page. > > However, I would like to keep the user

login_required decorator in Django: open modal instead of redirecting to another page

2015-04-08 Thread Roh Codeur
Hi I have a django app which has certain sections which are reserved for registered users. I have the views annotated with login_required decorator which redirects the user to a login page. However, I would like to keep the user on the same page and open up a modal dialog prompting user to

Re: login_required in urlpatterns TypeError 'tuple' object is not callable

2015-01-27 Thread Collin Anderson
Hi, Something like this might work: from home.urls import urlpatterns as home_urls url('^home/', include(list(login_required(x) for x in home_urls))) Collin On Friday, January 23, 2015 at 7:09:30 PM UTC-5, Vijay Khemlani wrote: > > I may be mistaken, but I don't thin

Re: login_required in urlpatterns TypeError 'tuple' object is not callable

2015-01-23 Thread Vijay Khemlani
I may be mistaken, but I don't think you can decorate an entire "include" call On Fri, Jan 23, 2015 at 8:51 PM, Neto wrote: > Hi, I'm using login_required in url patterns but it does an error: > > urls.py > > from django.conf.urls i

login_required in urlpatterns TypeError 'tuple' object is not callable

2015-01-23 Thread Neto
Hi, I'm using login_required in url patterns but it does an error: urls.py from django.conf.urls import patterns, include, url from django.contrib.auth.decorators import login_required urlpatterns = patterns('', url(r'^home/', login_required(include('home.urls

Re: Return to the requested page after successfull @login_required by the next variable

2015-01-09 Thread Vijay Khemlani
i, Jan 9, 2015 at 2:02 AM, Robin Lery wrote: > Suppose this is the url after > `@login_required(login_url='/accounts/required_login/')`: > > http://ngoksy.com/accounts/login_required/?next=/article/ > > view for the login_require: > > > *def required_login(

Return to the requested page after successfull @login_required by the next variable

2015-01-08 Thread Robin Lery
Suppose this is the url after `@login_required(login_url='/accounts/required_login/')`: http://ngoksy.com/accounts/login_required/?next=/article/ view for the login_require: *def required_login(request):return render(request, 'required_login.html')* I tried ad

Re: Using login_required decorator

2014-12-02 Thread Rootz
7; with >> an error message as stated "TypeError at /login/ object() takes no >> parameters" >> >> The django project url >> >> >> (r'^detail/(?P\d{1,10})/$',login_required(views.DetailViewMember.as_view)), >> >> > This

Re: Using login_required decorator

2014-12-02 Thread Daniel Roseman
The django project url > > > (r'^detail/(?P\d{1,10})/$',login_required(views.DetailViewMember.as_view)), > > This has nothing to do with the decorator. You need to *call* the as_view method: (r'^detail/(?P\d{1,10})/$',login_required(views. DetailViewMember.as_view())),

Re: Using login_required decorator

2014-12-01 Thread JJ Zolper
The best way to require login to certain url and view hooks is the: @login_required decorator. Let me show you how I have it setup: My "Profile" view is the profile a user sees once they are logged in to then have the ability to edit their information so obviously this needs to have

Using login_required decorator

2014-12-01 Thread Rootz
are redirected to an example url link like this '/login?next=/detail/1/' with an error message as stated "TypeError at /login/ object() takes no parameters" The django project url (r'^detail/(?P\d{1,10})/$',login_required(views.DetailViewMember.as_view)), url(r

Re: @method_decorator(login_required) but how to add "login_url=''login/" to login_required

2014-05-29 Thread Kwaw Annor
t; Thank your help,but could you tell me how to set in setting.py? > And I preffer to use the code style in funtional view ,like > @login_required(login_url='abclogin/') > def get_list(request): > pass > In class based view,I can't do like this? > > 在 201

Re: More robust way of handling login_required decorator?

2013-07-13 Thread shmengie
AUTH_REQUIRED = True/False # default False for backward compatibility Normal behaviour unless assigned a pointer to Login CBV or FBV that returns user to the original URI upon successful login. I suspect this needs to be posted on the Developer forum. -Joe -- You received this message becau

Re: More robust way of handling login_required decorator?

2013-07-13 Thread shmengie
oper wrote: > > I make heavy use the login_required decorator and for the most part it > is extremely easy to use when using FBVs but when using CBVs one either > has to add a dispatch method to the class calling the super classes > dispatch method or you need to put the

Re: More robust way of handling login_required decorator?

2013-07-13 Thread Some Developer
On 13/07/13 14:50, Peith Vergil wrote: django-braces have a LoginRequiredMixin. Using it is a much cleaner solution to overriding the dispatch method. Thanks for the tip. I'll check it out. -- You received this message because you are subscribed to th

Re: More robust way of handling login_required decorator?

2013-07-13 Thread Peith Vergil
django-braces <https://github.com/brack3t/django-braces> have a LoginRequiredMixin. Using it is a much cleaner solution to overriding the dispatch method. On Sat, Jul 13, 2013 at 6:56 PM, Some Developer wrote: > I make heavy use the login_required decorator and for the most p

More robust way of handling login_required decorator?

2013-07-13 Thread Some Developer
I make heavy use the login_required decorator and for the most part it is extremely easy to use when using FBVs but when using CBVs one either has to add a dispatch method to the class calling the super classes dispatch method or you need to put the login_required in the url configuration

Re: @method_decorator(login_required) but how to add "login_url=''login/" to login_required

2013-05-26 Thread nany
Thank your help,but could you tell me how to set in setting.py? And I preffer to use the code style in funtional view ,like @login_required(login_url='abclogin/') def get_list(request): pass In class based view,I can't do like this? 在 2013年5月25日星期六UTC+8下午11时23分39秒,Sergiy Kho

Re: @method_decorator(login_required) but how to add "login_url=''login/" to login_required

2013-05-25 Thread Sergiy Khohlov
you can set it in setting.py file Many thanks, Serge +380 636150445 skype: skhohlov On Sat, May 25, 2013 at 9:33 AM, nany wrote: > @method_decorator(login_required) but how to add "login_url=''/login/" to > login_required > > in function view, I use @login_

@method_decorator(login_required) but how to add "login_url=''login/" to login_required

2013-05-25 Thread nany
@method_decorator(login_required) but how to add "login_url=''/login/" to login_required in function view, I use @login_required(login_url='login/') but in class based view, how? Anyone help?Thank you. -- You received this message because you are subscribed to th

Re: Bug in login_required?

2013-03-15 Thread chirale
Il giorno venerdì 10 luglio 2009 02:34:59 UTC+2, Manoj Govindan ha scritto: > This problem was logged as a bug and closed without fixing because the > development team thought it was not worthwhile. Time for necroposting. As of 2013, the 1.5 version of Django has nice news for us: This sett

Re: @login_required do nothing

2012-04-30 Thread marcelo nicolet
u set the LOGIN_URL setting in settings.py? That setting should be assigned a location(e.g., "/login/") to redirect to when your view is called without the user logged in. Also, you can do this if for some reason you don't want to have that setting.

Re: @login_required do nothing

2012-04-29 Thread Reinout van Rees
On 28-04-12 21:00, marcelo nicolet wrote: Following the on-line docs ( https://docs.djangoproject.com/en/1.4/topics/auth/ ) I decorated my "index" view with @login_required, but nothing happens. In other words, it'supossed I would be redirected to a login page, else an exception m

Re: @login_required do nothing

2012-04-28 Thread yati sagade
Hi Have you set the LOGIN_URL setting in settings.py? That setting should be assigned a location(e.g., "/login/") to redirect to when your view is called without the user logged in. Also, you can do this if for some reason you don't want to have that setting. @login_required(lo

Re: @login_required do nothing

2012-04-28 Thread Jonathan Baker
e module at the top of your script: from >> django.contrib.auth.decorators import login_required. Otherwise, it's never >> in scope and thus not available. >> >> Sent from my iPhone >> >> On Apr 28, 2012, at 1:00 PM, marcelo >> nicolet> >> wrote: >> &

Re: @login_required do nothing

2012-04-28 Thread marcelo nicolet
have to be sure and import the module at the top of your script: from django.contrib.auth.decorators import login_required. Otherwise, it's never in scope and thus not available. Sent from my iPhone On Apr 28, 2012, at 1:00 PM, marcelo nicolet wrote: Hi Following the on-line do

Re: @login_required do nothing

2012-04-28 Thread Jonathan D. Baker
You have to be sure and import the module at the top of your script: from django.contrib.auth.decorators import login_required. Otherwise, it's never in scope and thus not available. Sent from my iPhone On Apr 28, 2012, at 1:00 PM, marcelo nicolet wrote: > Hi > Following the o

@login_required do nothing

2012-04-28 Thread marcelo nicolet
Hi Following the on-line docs ( https://docs.djangoproject.com/en/1.4/topics/auth/ ) I decorated my "index" view with @login_required, but nothing happens. In other words, it'supossed I would be redirected to a login page, else an exception migth raise. But the whole thing

include() combined with login_required()

2011-11-13 Thread Gelonida N
Hi, I wondered whether (and if yes how) I can combine login_required and include() in my urls.py file Basically I'd like to require login for every url belonging to a certain application. currently urls.py looks like: from django.conf.urls.defaults import patterns, include, url

Re: @login_required & Redirect...best practice?

2011-05-28 Thread Mick
When I have a view that's @login_required -- and the user isn't logged > in -- what's the best way to deal with the URL they wanted in the > first place? Assuming they log in properly and I want to then > redirect them on to where they intended to go in the first > place

@login_required & Redirect...best practice?

2011-05-27 Thread Robin
When I have a view that's @login_required -- and the user isn't logged in -- what's the best way to deal with the URL they wanted in the first place? Assuming they log in properly and I want to then redirect them on to where they intended to go in the first place...what's the

Re: curl pages behind login_required

2011-05-08 Thread Jacob Kaplan-Moss
On Sun, May 8, 2011 at 3:17 PM, CarlFK wrote: > I am trying to curl pages that require being logged in via django's > default auth.  I don't care if the actual login is done with curl, > python, firefox or whatever is easiest. Are you wedded to curl for the download? If it were me, I'd use someth

Re: curl pages behind login_required

2011-05-08 Thread Shawn Milochik
And just to be clear, I wasn't saying go away. I think you can authenticate completely in curl. If not you can in wget. -- 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 unsubs

Re: curl pages behind login_required

2011-05-08 Thread Shawn Milochik
Do a Google search on using cookies in curl. On May 8, 2011 4:17 PM, "CarlFK" wrote: > I am trying to curl pages that require being logged in via django's > default auth. I don't care if the actual login is done with curl, > python, firefox or whatever is easiest. > > This only works sometimes, so

curl pages behind login_required

2011-05-08 Thread CarlFK
I am trying to curl pages that require being logged in via django's default auth. I don't care if the actual login is done with curl, python, firefox or whatever is easiest. This only works sometimes, so I am missing something: install https://addons.mozilla.org/en-us/firefox/addon/export-cookie

Re: Problem with django auth login_required and lighttpd

2011-01-11 Thread Eric Chamberlain
John, We have a similar configuration, try adding: FORCE_SCRIPT_NAME = '' to settings.py On Jan 11, 2011, at 2:44 PM, John Finlay wrote: > I'm trying to serve django pages using mod_fastcgi from a lighttpd server. > Everything works well using the setup recommended in the documentation excep

Problem with django auth login_required and lighttpd

2011-01-11 Thread John Finlay
I'm trying to serve django pages using mod_fastcgi from a lighttpd server. Everything works well using the setup recommended in the documentation except for the initial login. The porblem seems to be that when the user tries: http://server/ the login page comes up with a url of: http://serve

Re: newbie question: @login_required, can't get it to work

2010-12-09 Thread Charlietuna
/' > > On Thu, Dec 9, 2010 at 3:04 PM, Charlietuna wrote: > > Hi All, > > > I'm a newbie. I would like to use the @login_required decorator, but I > > don't want to redirect to the standard default accounts/login. I would > > like to redirect to 

Re: newbie question: @login_required, can't get it to work

2010-12-09 Thread Charlietuna
All, > > > I'm a newbie. I would like to use the @login_required decorator, but I > > don't want to redirect to the standard default accounts/login. I would > > like to redirect to '/login/' > > > The book says add the following to th

Re: newbie question: @login_required, can't get it to work

2010-12-08 Thread Martin Melin
On Thu, Dec 9, 2010 at 8:04 AM, Charlietuna wrote: > Hi All, > > I'm a newbie. I would like to use the @login_required decorator, but I > don't want to redirect to the standard default accounts/login. I would > like to redirect to '/login/' > > The book

Re: newbie question: @login_required, can't get it to work

2010-12-08 Thread robin nanola
on your settings.py you can just add LOGIN_URL = '/login/' On Thu, Dec 9, 2010 at 3:04 PM, Charlietuna wrote: > Hi All, > > I'm a newbie. I would like to use the @login_required decorator, but I > don't want to redirect to the standard default accounts/logi

newbie question: @login_required, can't get it to work

2010-12-08 Thread Charlietuna
Hi All, I'm a newbie. I would like to use the @login_required decorator, but I don't want to redirect to the standard default accounts/login. I would like to redirect to '/login/' The book says add the following to the end of the settings.py file.: import

Re: login_required and new class based views

2010-10-23 Thread Łukasz Rekucki
xin(object): >> >>     def dispatch(self, *args, **kwargs): >>         bound_dispatch = super(LoginRequired, self).dispatch >>         return login_required(bound_dispatch)(*args, **kwargs) This discussion has moved to django-developers. It starts in [1] and then continued in [

Re: login_required and new class based views

2010-10-23 Thread Joachim Pileborg
spatch = super(LoginRequired, self).dispatch > return login_required(bound_dispatch)(*args, **kwargs) This solution looks cleanest, and is easiest to implement. However there is a problem if two or more similar mixins are used: The order of the calls are dependant on the order the view inherits t

Re: login_required and new class based views

2010-10-20 Thread Harro
apped around the view. On Oct 20, 1:12 pm, Russell Keith-Magee wrote: > 2010/10/20 Łukasz Rekucki : > > > On 19 October 2010 19:06, Valentin Golev wrote: > >> Hello, > > > 2) decorate the dispatch method. You need to turn login_required into > > a method decorato

Re: Different logins in same browser session and login_required

2010-10-20 Thread PyMan
> > > It shouldn't happen, but it could. It's an office or it's a warehouse, > > people could work with the same user and/or (above all) people may > > work on the same machine...so they should pay attention on what they > > do...but even no. > > > Just an example when the problem can occurs: > >

Re: Different logins in same browser session and login_required

2010-10-20 Thread Steve Holden
On 10/20/2010 5:20 AM, PyMan wrote: > > > On 20 Ott, 10:28, Daniel Roseman wrote: >> On Oct 20, 8:11 am, PyMan wrote: >> Firefox has long had its "profile" functionality. >> firefox -no-remote -ProfileManager >> You can create multiple firefox profiles, then run multiple instance

Re: login_required and new class based views

2010-10-20 Thread Russell Keith-Magee
2010/10/20 Łukasz Rekucki : > On 19 October 2010 19:06, Valentin Golev wrote: >> Hello, >> > 2) decorate the dispatch method. You need to turn login_required into > a method decorator first (Django should probably provide a tool for > this). Django does :-) It's c

Re: Different logins in same browser session and login_required

2010-10-20 Thread PyMan
On 20 Ott, 10:28, Daniel Roseman wrote: > On Oct 20, 8:11 am, PyMan wrote: > > > > Firefox has long had its "profile" functionality. > > > > firefox -no-remote -ProfileManager > > > > You can create multiple firefox profiles, then run multiple instances of > > > firefox at once - so long as you

Re: Different logins in same browser session and login_required

2010-10-20 Thread Daniel Roseman
On Oct 20, 8:11 am, PyMan wrote: > > Firefox has long had its "profile" functionality. > > > firefox -no-remote -ProfileManager > > > You can create multiple firefox profiles, then run multiple instances of > > firefox at once - so long as you use different profiles for them.  A bit > > fiddly, bu

Re: Different logins in same browser session and login_required

2010-10-20 Thread PyMan
> > Firefox has long had its "profile" functionality. > > firefox -no-remote -ProfileManager > > You can create multiple firefox profiles, then run multiple instances of > firefox at once - so long as you use different profiles for them.  A bit > fiddly, but obviously useful for development/testing

Re: login_required and new class based views

2010-10-19 Thread Valentin Golev
06, Valentin Golev wrote: >>>> Hello, >>>> >>>> I'm trying to start using new class based views from the trunk. >>>> >>>> I need to rewrite a view which is decorated >>>> django.contrib.auth.decorators.login_required. &g

Re: login_required and new class based views

2010-10-19 Thread Łukasz Rekucki
How should I go with that? >> There are couple of options. >> >> 1) decorate the final view (for use in urls.py): >> >>   decorated_view = login_required(MyView.as_view) >> >> In this option, you lose the ability to subclass the decorated view. >> >&g

Re: login_required and new class based views

2010-10-19 Thread Valentin Golev
e of options. > > 1) decorate the final view (for use in urls.py): > >   decorated_view = login_required(MyView.as_view) > > In this option, you lose the ability to subclass the decorated view. > > 2) decorate the dispatch method. You need to turn login_required into > a method decor

Re: login_required and new class based views

2010-10-19 Thread Łukasz Rekucki
uple of options. 1) decorate the final view (for use in urls.py): decorated_view = login_required(MyView.as_view) In this option, you lose the ability to subclass the decorated view. 2) decorate the dispatch method. You need to turn login_required into a method decorator first (Django should pro

login_required and new class based views

2010-10-19 Thread Valentin Golev
Hello, I'm trying to start using new class based views from the trunk. I need to rewrite a view which is decorated django.contrib.auth.decorators.login_required. How should I go with that? I was going to write something like LoginRequiredMixin, but I have no idea how to do this. I need to run m

Re: Different logins in same browser session and login_required

2010-10-19 Thread David De La Harpe Golden
On 19/10/10 17:03, Bill Freeman wrote: > This is a limitation of the browser. It does not keep separate credentials > for separate windows. This is usually desirable because you may choose > to open a link in a new window (or tab) and you still expect to be logged in. > IE8 (and probably other

Re: Different logins in same browser session and login_required

2010-10-19 Thread Bill Freeman
r "U1" is already logged in > in both windows. > 2) In the browser window "W1" the user logs out > 3) In the browser window "W1" the user "U2" logins in and gets > redirect to the main web page > 4) In the browser window "W2" any call to t

Different logins in same browser session and login_required

2010-10-19 Thread PyMan
t;W2" where the user "U1" is already logged in in both windows. 2) In the browser window "W1" the user logs out 3) In the browser window "W1" the user "U2" logins in and gets redirect to the main web page 4) In the browser window "W2" any cal

Re: Confused about testing a page protected with @login_required

2010-10-06 Thread Brandon Taylor
test fails :( Hope this helps someone, Brandon On Oct 5, 11:37 pm, Brandon Taylor wrote: > Hi everyone, > > I set up a bare-bones project with one view decorated with > @login_required. > I created an initial_data.json fixture with a user. > I called self.client.login(username=&#x

Confused about testing a page protected with @login_required

2010-10-05 Thread Brandon Taylor
Hi everyone, I set up a bare-bones project with one view decorated with @login_required. I created an initial_data.json fixture with a user. I called self.client.login(username='foobar', passowrd='foobar') and it returned True. I assigned a response variable from self.cl

Re: Problem testing a view decorated with @login_required

2010-09-26 Thread Brandon Taylor
Sorry, the second test is the one that fails. On Sep 26, 2:01 pm, Brandon Taylor wrote: > Hi Everyone, > > I'm having an issue testing a page protected with @login_required. I'm > loading a user via a fixture. I can call > self.client.login(**credentials) successfully

Problem testing a view decorated with @login_required

2010-09-26 Thread Brandon Taylor
Hi Everyone, I'm having an issue testing a page protected with @login_required. I'm loading a user via a fixture. I can call self.client.login(**credentials) successfully and get True back. I can retrieve a User object using the _auth_user_id key held in session from the call to self.cl

Re: Test failing on @login_required view

2010-04-25 Thread eka (Esteban)
ld a test for a view that's decorated with > @login_required, since I failed to make it work, I did a simple test > and still can't make it pass. > > Here is the code for the simple test and the view: > > def test_login(self): >     user = self._create_new_user() >

Test failing on @login_required view

2010-04-24 Thread eka (Esteban)
Hi all, I'm trying to build a test for a view that's decorated with @login_required, since I failed to make it work, I did a simple test and still can't make it pass. Here is the code for the simple test and the view: def test_login(self): user = self._create_new_user()

Re: Two user account types and login_required decorator

2010-03-19 Thread Paulo Almeida
database with > accounts and settings for internal access, the second part is customer > access with different interface and functionality. For internal access I am > using django.contrib.auth and login_required decorator. This decorator > redirect the user to settings.LOGIN_URL in

Two user account types and login_required decorator

2010-03-19 Thread Martin Tiršel
Hello, I am programming an application where one part is customer database with accounts and settings for internal access, the second part is customer access with different interface and functionality. For internal access I am using django.contrib.auth and login_required decorator. This

Re: @login_required decorator sends me to the wrong URL

2009-11-19 Thread Preston Holmes
http://docs.djangoproject.com/en/1.1/ref/settings/#login-url There are going to be some other places you will have to be careful running django on a path other than / -Preston On Nov 19, 7:11 am, Stodge wrote: > I added the @login_required decorator to my view but it redirects me &

@login_required decorator sends me to the wrong URL

2009-11-19 Thread Stodge
I added the @login_required decorator to my view but it redirects me to: http://localhost/accounts/login whereas the URL for my site is: http://localhost/test/accounts/login This is on Apache. Did I forget to configure something in settings.py? Thanks -- You received this message because

Re: Middleware to replace @login_required SOLVED, + PCI Compliance

2009-10-15 Thread Shawn Milochik
Ethan, Thanks for the feedback. I did create my own middleware, and it was ridiculously simple. I just looked at the django.middleware files and saw how easy it was. I only had to make exceptions for the pages pertaining to resetting a forgotten password (from django.contrib.auth.views) and the

Re: Middleware to replace @login_required

2009-10-15 Thread Ethan Jucovy
On Thu, Oct 15, 2009 at 12:24 PM, Shawn Milochik wrote: > > Middleware question: > > If 100% of an apps views require a logged-in user except for the login > page, does it makes sense to have middleware check the URL and > redirect to the login page rather than putting t

Middleware to replace @login_required

2009-10-15 Thread Shawn Milochik
Middleware question: If 100% of an apps views require a logged-in user except for the login page, does it makes sense to have middleware check the URL and redirect to the login page rather than putting the @login_required decorator over all the views? I have to ensure that users' pass

Re: login_required redirects to a specific url

2009-09-28 Thread V
y, maybe you should use something like that: > > @login_required(redirect_field_name='redirect_to') > > Where `redirect_to' is the address for a specific page. > > -Original Message- > From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com]

RE: login_required redirects to a specific url

2009-09-27 Thread Сергей Зигачев
Sorry, maybe you should use something like that: @login_required(redirect_field_name='redirect_to') Where `redirect_to' is the address for a specific page. -Original Message- From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] On Behalf Of

Re: login_required redirects to a specific url

2009-09-27 Thread V
plement the LOGIN_URL value in your > settings.py file. > > From: django-users@googlegroups.com [mailto:django-us...@googlegroups.com] > On Behalf Of }--o > Sent: Sunday, September 27, 2009 7:18 PM > To: django-users > Subject: login_required redirects to a specific url > > H

RE: login_required redirects to a specific url

2009-09-27 Thread Сергей Зигачев
7:18 PM To: django-users Subject: login_required redirects to a specific url Hi, I'm using the login_required decorator extensively, but have one view where instead of the default landing page ('accounts/login') I would like to redirect it to a specific page. Is there a simple

login_required redirects to a specific url

2009-09-27 Thread }--o
Hi, I'm using the login_required decorator extensively, but have one view where instead of the default landing page ('accounts/login') I would like to redirect it to a specific page. Is there a simple way to do this? Viktor --~--~-~--~~~---~--~~ Yo

Re: best option to override login_required decorator

2009-09-16 Thread Karen Tracey
On Wed, Sep 16, 2009 at 4:53 AM, Robert wrote: > > As a business requirement we have to show login form in an ajax > response for some login_required actions. I want to change the > login_required decorator to behaive differently in case the request is > an ajax request and n

best option to override login_required decorator

2009-09-16 Thread Robert
As a business requirement we have to show login form in an ajax response for some login_required actions. I want to change the login_required decorator to behaive differently in case the request is an ajax request and not a normal GET / POST request. What do you think is the best way to override

Re: Using the @login_required() decorator with #hash url's

2009-07-28 Thread Jumpfroggy
> The only way I know around this involves leaning on JavaScript to > get the URL, split off the #hash bit from it, and sneak it in as > a hidden element on the login form. Yeah, I ended up doing this on the /login page. Basically: $(function() { $('#url-hash').attr('va

Re: @login_required() dont work

2009-07-28 Thread Superman
Still doesn't work :( I have the same problem. I use python 2.5 and my code is... from django.contrib.auth.decorators import login_required @login_required def vote(request, poll_id): p = get_object_or_404(Poll, pk=poll_id)

Re: @login_required() dont work

2009-07-23 Thread Jonas Obrist
that should be @login_required def index(request): ... as far as i know, pretty sure your () are the problem Asinox wrote: > Hi guys, im trying to use the login and logout functions of Django, > but my @login_required() dont work, dont redirecto to the login form > and show the view

@login_required() dont work

2009-07-23 Thread Asinox
Hi guys, im trying to use the login and logout functions of Django, but my @login_required() dont work, dont redirecto to the login form and show the view where the user need to be logged... VIEW from django.shortcuts import render_to_response, get_object_or_404, Http404 from

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Tim Chase
> The first problem is that the django server only receives the '/page' > part of the URL. The browser itself holds onto the '#hash' part and > doesn't transmit that to the django server at all, so the > login_required() decorator calls request.get_full_path(

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 4:08 PM, Tom Evans wrote: >> 1: no #section1 in the HTML => Django is losing it, should be fixed > > Re-read the thread. The #part of the URL is not something ever > transmitted beyond the browser. No web application ever sees the #part > of a URI. as i understand it, the

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Michael
On Thu, Jul 16, 2009 at 12:00 PM, Javier Guerra wrote: > > On Thu, Jul 16, 2009 at 3:51 PM, Michael wrote: > > This information isn't transmitted to the server in anyway so short of > what > > you described above, Django can't really solve your issue. > > but where is it getting lost? i mean, wh

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Tom Evans
On Thu, 2009-07-16 at 16:00 +, Javier Guerra wrote: > On Thu, Jul 16, 2009 at 3:51 PM, Michael wrote: > > This information isn't transmitted to the server in anyway so short of what > > you described above, Django can't really solve your issue. > > but where is it getting lost? i mean, what

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 3:51 PM, Michael wrote: > This information isn't transmitted to the server in anyway so short of what > you described above, Django can't really solve your issue. but where is it getting lost? i mean, what does the html looks like? does it have the #section1 in the action

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Michael
The browser itself holds onto the '#hash' part and > doesn't transmit that to the django server at all, so the > login_required() decorator calls request.get_full_path() and gets '/ > page', so that's what it uses. It doesn't look like there&#

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Jumpfroggy
it that to the django server at all, so the login_required() decorator calls request.get_full_path() and gets '/ page', so that's what it uses. It doesn't look like there's a simple way to get the '#hash' from django. On

Re: Using the @login_required() decorator with #hash url's

2009-07-16 Thread Javier Guerra
On Thu, Jul 16, 2009 at 2:58 PM, Jumpfroggy wrote: > > Currently, the @login_required() decorator does not preserve any #hash > part of the URL.  So if I go to /page#section1 without being logged > in, I'm redirected to /login?next=/page#section1.  After logging in, > I&#

Using the @login_required() decorator with #hash url's

2009-07-16 Thread Jumpfroggy
Currently, the @login_required() decorator does not preserve any #hash part of the URL. So if I go to /page#section1 without being logged in, I'm redirected to /login?next=/page#section1. After logging in, I'm redirected to /page (without the hash part). I read in another thread her

Re: Bug in login_required?

2009-07-09 Thread Manoj Govindan
This problem was logged as a bug and closed without fixing because the development team thought it was not worthwhile. See Jacob K-M's comment at the bottom for an explanation why. http://code.djangoproject.com/ticket/8906 On Jun 3, 10:30 pm, "eric.frederich" wrote: > So the person in IT that r

Re: Bug in login_required?

2009-06-03 Thread Jashugan
On Jun 3, 10:30 am, "eric.frederich" wrote: > Is there a technical reason that this can't be done?  I noticed I can > set LOGIN_URL in settings but it seems weird that everything else in > the system seems to work fine except this one piece.   I have to do this as well. But I don't use named url

Bug in login_required?

2009-06-03 Thread eric.frederich
till works. It uses some get_script_prefix() function. What I noticed didn't work is the login_required decorator. It doesn't make use of this prefix. Is there a technical reason that this can't be done? I noticed I can set LOGIN_URL in settings but it seems weird that everythi

Re: Is there a version of @login_required that requires the user to log in as a specific user?

2009-05-25 Thread Brian Neal
On May 25, 3:41 am, Andy wrote: > > But how do I stop user A from trying to edit the profile of user B? You don't let them. You control which profile you get from and save to the database, right? You look at the request.user object and only manipulate the data associated with the user specified

Re: Is there a version of @login_required that requires the user to log in as a specific user?

2009-05-25 Thread Sieker Adi Jörg
m = None > if profile.username == request.user.username: > form = UserProfileForm() > > render_to_response('profile/profile.html', {'form': > form, 'profile':profile}, context_instance=RequestContext(request)) Change the view to something l

  1   2   >