Re: Login Issues

2012-03-03 Thread hack
That seemed to fix part of the issue, but now I get this message:

Page not found (404)
Request Method: GET
Request URL:http://localhost:8000/accounts/profile/
Using the URLconf defined in coolstuff.urls, Django tried these URL
patterns, in this order:
^coolapp/
The current URL, accounts/profile/, didn't match any of these.
You're seeing this error because you have DEBUG = True in your Django
settings file. Change that to False, and Django will display a
standard 404 page.

On Feb 28, 3:02 pm, "rafiee.nima"  wrote:
> sorry
> site_media=os.path.join(os.path.dirname(__file__),'site_media')   is
> not needed it was a line of code from my own project :D
>
> On Feb 28, 7:54 pm, "rafiee.nima"  wrote:
>
>
>
>
>
>
>
> > hi
> > check if you import login view in url.py to be like this :
> > from django.contrib.auth.views import login
>
> > and also check your pattern in url.py to be like this :
> > site_media=os.path.join(os.path.dirname(__file__),'site_media')
> > urlpatterns = patterns(' ',
> >     (r'^login/$',login), )
> > and dont change the location of login.html in registration.html
>
> > On Feb 28, 6:01 am, hack  wrote:
>
> > > I'm attempting to follow the instructions on the Django website and
> > > use the registration/login.html.  I created the file in myapp/
> > > registration/login.html.
>
> > > I've added the following to my urls.py file:
> > > url(r'^login/$', 'django.contrib.auth.views.login'),
>
> > > When I attempt to access /myapp/login I get the following error:
> > > Could not import hcp.views.django.contrib.auth.views. Error was: No
> > > module named django.contrib.auth.views
>
> > > I did setup my urls file by moving it into the myapp directory and
> > > putting the following in the original:
> > > url(r'^myapp/',include('myapp.urls')),
>
> > > Any suggestions on why django thinks the template doesn't exist?  Any
> > > help would be greatly appreciated.  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: Login Issues

2012-02-28 Thread rafiee.nima
sorry
site_media=os.path.join(os.path.dirname(__file__),'site_media')   is
not needed it was a line of code from my own project :D

On Feb 28, 7:54 pm, "rafiee.nima"  wrote:
> hi
> check if you import login view in url.py to be like this :
> from django.contrib.auth.views import login
>
> and also check your pattern in url.py to be like this :
> site_media=os.path.join(os.path.dirname(__file__),'site_media')
> urlpatterns = patterns(' ',
>     (r'^login/$',login), )
> and dont change the location of login.html in registration.html
>
> On Feb 28, 6:01 am, hack  wrote:
>
>
>
>
>
>
>
> > I'm attempting to follow the instructions on the Django website and
> > use the registration/login.html.  I created the file in myapp/
> > registration/login.html.
>
> > I've added the following to my urls.py file:
> > url(r'^login/$', 'django.contrib.auth.views.login'),
>
> > When I attempt to access /myapp/login I get the following error:
> > Could not import hcp.views.django.contrib.auth.views. Error was: No
> > module named django.contrib.auth.views
>
> > I did setup my urls file by moving it into the myapp directory and
> > putting the following in the original:
> > url(r'^myapp/',include('myapp.urls')),
>
> > Any suggestions on why django thinks the template doesn't exist?  Any
> > help would be greatly appreciated.  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: Login Issues

2012-02-28 Thread rafiee.nima
hi
check if you import login view in url.py to be like this :
from django.contrib.auth.views import login

and also check your pattern in url.py to be like this :
site_media=os.path.join(os.path.dirname(__file__),'site_media')
urlpatterns = patterns(' ',
(r'^login/$',login), )
and dont change the location of login.html in registration.html



On Feb 28, 6:01 am, hack  wrote:
> I'm attempting to follow the instructions on the Django website and
> use the registration/login.html.  I created the file in myapp/
> registration/login.html.
>
> I've added the following to my urls.py file:
> url(r'^login/$', 'django.contrib.auth.views.login'),
>
> When I attempt to access /myapp/login I get the following error:
> Could not import hcp.views.django.contrib.auth.views. Error was: No
> module named django.contrib.auth.views
>
> I did setup my urls file by moving it into the myapp directory and
> putting the following in the original:
> url(r'^myapp/',include('myapp.urls')),
>
> Any suggestions on why django thinks the template doesn't exist?  Any
> help would be greatly appreciated.  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.



Login Issues

2012-02-27 Thread hack
I'm attempting to follow the instructions on the Django website and
use the registration/login.html.  I created the file in myapp/
registration/login.html.

I've added the following to my urls.py file:
url(r'^login/$', 'django.contrib.auth.views.login'),

When I attempt to access /myapp/login I get the following error:
Could not import hcp.views.django.contrib.auth.views. Error was: No
module named django.contrib.auth.views

I did setup my urls file by moving it into the myapp directory and
putting the following in the original:
url(r'^myapp/',include('myapp.urls')),

Any suggestions on why django thinks the template doesn't exist?  Any
help would be greatly appreciated.  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: Login issues

2007-09-11 Thread MikeHowarth

Russ

Thanks for the reply Russ, I totally missed this.

I did wonder whether this was because I was using the email-auth
backend.

I'll implement your suggestion and see what happens.

On Sep 11, 1:50 am, "Russell Keith-Magee" <[EMAIL PROTECTED]>
wrote:
> On 9/10/07, MikeHowarth <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi guys
>
> > Was wondering if anyone knew of any bugs within the user
> > authentication system associated to setting the backend attribute?
>
> Not that I'm aware of - and certainly not with the default
> authentication backend.
>
> > Basically looking at the traceback the user object expects a attribute
> > 'backend' to be set within however this doesn not seem to be set.
>
> My guess here would be to check that the user object that is produced
> in the clean method by the authentication is the same object that is
> used in the login method. The code you defines the user as a class
> attribute, not an instance attribute, but you are using it as an
> instance attribute in the login method. Depending on how you are
> instantiating and using this form, you may be getting some wierd
> behaviour.
>
> Yours,
> Russ Magee %-)


--~--~-~--~~~---~--~~
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: Login issues

2007-09-10 Thread Russell Keith-Magee

On 9/10/07, MikeHowarth <[EMAIL PROTECTED]> wrote:
>
> Hi guys
>
> Was wondering if anyone knew of any bugs within the user
> authentication system associated to setting the backend attribute?

Not that I'm aware of - and certainly not with the default
authentication backend.

> Basically looking at the traceback the user object expects a attribute
> 'backend' to be set within however this doesn not seem to be set.

My guess here would be to check that the user object that is produced
in the clean method by the authentication is the same object that is
used in the login method. The code you defines the user as a class
attribute, not an instance attribute, but you are using it as an
instance attribute in the login method. Depending on how you are
instantiating and using this form, you may be getting some wierd
behaviour.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
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: Login issues

2007-09-10 Thread MikeHowarth

Anyone?

On Sep 9, 5:47 pm, MikeHowarth <[EMAIL PROTECTED]> wrote:
> Hi guys
>
> Was wondering if anyone knew of any bugs within the user
> authentication system associated to setting the backend attribute?
>
> Basically looking at the traceback the user object expects a attribute
> 'backend' to be set within however this doesn not seem to be set.
>
> Traceback:
>
> Traceback (most recent call last):
> File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
> get_response
>   77. response = callback(request, *callback_args, **callback_kwargs)
> File "D:\Web Dev\Test\eshop\..\eshop\login\views.py" in login
>   10. if loginform.login(request):
> File "D:\Web Dev\Test\eshop\..\eshop\login\forms.py" in login
>   56. login(request, self.user)
> File "C:\Python25\lib\site-packages\django\contrib\auth\__init__.py"
> in login
>   53. request.session[BACKEND_SESSION_KEY] = user.backend
>
>   AttributeError at /login/
>   'User' object has no attribute 'backend'
>
> Forms.py
>
> class LoginForm(forms.Form):
>
> username = forms.CharField(label=_('username'))
> password = forms.CharField(label=_('password'))
> user = None   # allow access to user object
>
> def clean(self):
>
> # only do further checks if the rest was valid
> if self._errors: return
>
> from django.contrib.auth import login, authenticate
>
> user = authenticate(username=self.data['username'],
> password=self.data['password'])
>
> if user is not None:
> if user.is_active:
> self.user = user
> else:
> raise forms.ValidationError(ugettext(
> 'This account is currently inactive. Please
> contact '
> 'the administrator if you believe this to be
> in error.'))
> else:
> raise forms.ValidationError(ugettext(
> 'The username and password you specified are not
> valid.'))
>
> def login(self, request):
>
> from django.contrib.auth import login
>
> if self.is_valid():
> login(request, self.user)
> return True
> return False


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



Login issues

2007-09-09 Thread MikeHowarth

Hi guys

Was wondering if anyone knew of any bugs within the user
authentication system associated to setting the backend attribute?

Basically looking at the traceback the user object expects a attribute
'backend' to be set within however this doesn not seem to be set.

Traceback:

Traceback (most recent call last):
File "C:\Python25\lib\site-packages\django\core\handlers\base.py" in
get_response
  77. response = callback(request, *callback_args, **callback_kwargs)
File "D:\Web Dev\Test\eshop\..\eshop\login\views.py" in login
  10. if loginform.login(request):
File "D:\Web Dev\Test\eshop\..\eshop\login\forms.py" in login
  56. login(request, self.user)
File "C:\Python25\lib\site-packages\django\contrib\auth\__init__.py"
in login
  53. request.session[BACKEND_SESSION_KEY] = user.backend

  AttributeError at /login/
  'User' object has no attribute 'backend'

Forms.py

class LoginForm(forms.Form):

username = forms.CharField(label=_('username'))
password = forms.CharField(label=_('password'))
user = None   # allow access to user object

def clean(self):

# only do further checks if the rest was valid
if self._errors: return

from django.contrib.auth import login, authenticate

user = authenticate(username=self.data['username'],
password=self.data['password'])

if user is not None:
if user.is_active:
self.user = user
else:
raise forms.ValidationError(ugettext(
'This account is currently inactive. Please
contact '
'the administrator if you believe this to be
in error.'))
else:
raise forms.ValidationError(ugettext(
'The username and password you specified are not
valid.'))

def login(self, request):

from django.contrib.auth import login

if self.is_valid():
login(request, self.user)
return True
return False


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