authentication - Django, How to get user sign up statistics? -
i have django project using allauth handle user logins , signups.
all trying have way view sign-up stats. nice see how many user sign-ups there today vs yesterday , forth. not need fancy graphs or reports, numbers.
i have done quite lot of research on , haven't seen clean cut solution. have solution this?
thanks,
you can filter fromuser
using date joined field
according time.
from django.contrib.auth.models import user import datetime today = date.today().strftime('%y-%m-%d') yesterday = date.today()-timedelta(days=1) yesterday = yesterday.strftime('%y-%m-%d') this_month = date.today().strftime('%m') this_year = date.today().strftime('%y') today_signups = user.objects.filter(date_joined__gte=today).count() this_month_signups = user.objects.filter(date_joined__month=this_month, date_joined__year=this_year).count()
hope helps!!!!
Comments
Post a Comment