Re: Count the times a user has logged into the system

2007-08-02 Thread Chris Hoeppner

Seems a bit hacky actually. But if there's no other way...

Thanks a lot Mackenzie!

2007/8/2, Mackenzie Kearl <[EMAIL PROTECTED]>:
>
> you can just create a profile with a field number of times logged in.
> This could be updated in a custom login view that you write.
>
> check out http://www.djangobook.com/en/beta/chapter12/
>
> def login(request):
> username = request.POST['username']
> password = request.POST['password']
> user = auth.authenticate(username=username, password=password)
> if user is not None and user.is_active:
> # Correct password, and the user is marked "active"
> auth.login(request, user)
> # Redirect to a success page.
> return HttpResponseRedirect("/account/loggedin/")
> else:
> # Show an error page
> return HttpResponseRedirect("/account/invalid/")
>
>
> >
>


-- 
Best Regards,
Chris Hoeppner - www.pixware.org // My weblog

--~--~-~--~~~---~--~~
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: Count the times a user has logged into the system

2007-08-02 Thread Mackenzie Kearl

you can just create a profile with a field number of times logged in.
This could be updated in a custom login view that you write.

check out http://www.djangobook.com/en/beta/chapter12/

def login(request):
username = request.POST['username']
password = request.POST['password']
user = auth.authenticate(username=username, password=password)
if user is not None and user.is_active:
# Correct password, and the user is marked "active"
auth.login(request, user)
# Redirect to a success page.
return HttpResponseRedirect("/account/loggedin/")
else:
# Show an error page
return HttpResponseRedirect("/account/invalid/")


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



Count the times a user has logged into the system

2007-08-02 Thread Chris Hoeppner

I can recall this being covered some time ago, but google won't throw
up my answers. So, sorry for double post :)

I'd like to count the times a user has logged in (if possible without
hacking on contrib.auth). Actually just the first 10 times or so. I
want to show a few mini-tutorials the first few times the user logs
in. Like the first 3 or 5 times for basic stuff, and 7 - 8 for the
more esoteric features.

I can easily count, for example, the posts a user has made, since
they're linked to him through a foreign key (user.post_set.count())
and things like that, but how to count the times a user has logged in?

Thanks for your continuous help!


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