Newbie: can't login as user via standard admin login page

194 views
Skip to first unread message

bingbang

unread,
Nov 17, 2010, 6:26:59 PM11/17/10
to Django users
Dear all,
Started learning Django 3 days ago. Great tutorials. Just
made a modified version of the poll app. I am now facing a small
problem, given my newbie-ishness with Python, its proving to be a
little hard to solve for me. I searched this group and did find some
similar issues reported, I tried out the suggestions but there is
probably something I am missing here. Any suggestions will be
great :-) .

Problem: Can't login as a normal user via the standard http://127.0.0.1/admin/
page.
Can log in as admin, have created user account, have modified
permission, user account is active but still I get :Please enter a
correct username and passwd"

I have entered user accounts via the shell and the web interface..
neither user accounts work. Point to note is that in my urls.py I have
not set up a view for users, I have also not written any login() code
for users, I assumed that a user can login via the admin interface. Is
this valid.

I did read the /en/dev/faq/admin/ pages but it did not help a lot.

Any suggestions are very appreciated.

Thanks!

Thomas Schreiber

unread,
Nov 17, 2010, 8:48:46 PM11/17/10
to django...@googlegroups.com
Are you sure the user has been marked as is_staff or is_superuser?
http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.is_staff

> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
>

john doe

unread,
Nov 17, 2010, 8:58:39 PM11/17/10
to django...@googlegroups.com
On Wed, Nov 17, 2010 at 5:48 PM, Thomas Schreiber <t...@insatsu.us> wrote:
Are you sure the user has been marked as is_staff or is_superuser?
http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.models.User.is_staff

No the user is not marked as either because it is my goal to set up a normal user. I did not know that only users with is_staff or superuser status can log in via the admin console.

Is there an in-built view/page to easily let a user log in or do I have to set up even the user login page and the associated view.

I tried going through the Django user auth docs but am not clear where should I be putting in the python code for authenticating a user. Maybe I need to set up a view leading to a form, accept the values and process it.

Thanks though :-)

Daniel Roseman

unread,
Nov 18, 2010, 5:55:18 AM11/18/10
to Django users
On Nov 18, 1:58 am, john doe <thebiggestbangthe...@gmail.com> wrote:
> On Wed, Nov 17, 2010 at 5:48 PM, Thomas Schreiber <t...@insatsu.us> wrote:
> > Are you sure the user has been marked as is_staff or is_superuser?
>
> >http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth...
>
> No the user is not marked as either because it is my goal to set up a
> normal user. I did not know that only users with is_staff or superuser
> status can log in via the admin console.

That's what is_staff means, though: the right to access the admin
console. There's no point logging someone in who doesn't have access
to anything in there.

> Is there an in-built view/page to easily let a user log in or do I have to
> set up even the user login page and the associated view.

It's all provided for you in django.contrib.auth.views - see for
example the login function there. You just need to provide a template
and a place to redirect to afterwards.

> I tried going through the Django user auth docs but am not clear where
> should I be putting in the python code for authenticating a user. Maybe I
> need to set up a view leading to a form, accept the values and process it.

No need, see above.
--
DR.

John B

unread,
Nov 18, 2010, 3:16:48 AM11/18/10
to Django users
Hi,

Not sure what you mean by a "normal user". If you want them to access
the admin, make them staff. You can still control their ability to
create/update/delete data through permissions.

If you want them to be able to edit data but not necessarily access
admin, maybe look into making a view that renders a modelform, and use
the @login_required decorator.

There might be more elegant solutions... I'm a noob too, TBH.

John

On Nov 18, 12:58 pm, john doe <thebiggestbangthe...@gmail.com> wrote:
> On Wed, Nov 17, 2010 at 5:48 PM, Thomas Schreiber <t...@insatsu.us> wrote:
> > Are you sure the user has been marked as is_staff or is_superuser?
>
> >http://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth...
>
> > No the user is not marked as either because it is my goal to set up a
>
> normal user. I did not know that only users with is_staff or superuser
> status can log in via the admin console.
>
> Is there an in-built view/page to easily let a user log in or do I have to
> set up even the user login page and the associated view.
>
> I tried going through the Django user auth docs but am not clear where
> should I be putting in the python code for authenticating a user. Maybe I
> need to set up a view leading to a form, accept the values and process it.
>
> Thanks though :-)
>
>
>
> > On Wed, Nov 17, 2010 at 18:26, bingbang <thebiggestbangthe...@gmail.com>
> > django-users...@googlegroups.com<django-users%2Bunsu...@googlegroups.com>
> > .
> > > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users...@googlegroups.com<django-users%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages