Categories
Internet & Culture

usermanagement with django allauth.

usermanagement with django allauth: It is common for bots to register with a website. Often enough there are users instances in the user base that have registered at some point but did not verify their email-address.

Fortunately enough, for users of django and the excellent django-allauth, there are easy ways to manage these users.

First, the django ORM comes with an easy way to identify these users that did not verify their primary email:

>>> from django.contrib.auth.models import User
>>> unverified_users = User.objects.filter(emailaddress__verified=False, emailaddress__primary=True)
Bot User Management with django allauth
Mobile Phone User – Munich

The ORM allows simple filtering for unverified email addresses through a “relationship lookup”, that is emailaddress__verified=False in the above snippet. Of course, you may want to limit users for which the primary email address is unverified. That is the 2nd keyword argument to .filter() here: emailaddress__primary=True. The filter operator ANDs together these two conditions.

To identify users that not only have unverified, primary email addresses, but also appear to be idle, you may limit users that didn’t login through .exclude():

>> import datetime
>> old_unverified_users = unverified_users.exclude(last_login__gt=datetime.date(2020, 1, 1))

Will only give you users that have logged in after Jan 1st, 2020. Of course, the argument to last_login can be modified to match your requirements.

Finally, you may chose to either email these users and re-ask to verify their email. That would be a separate task, though. In our case, we simply delete these, since they are obviously not interessted in using our site:

old_unverified_users.delete() 

Categories
Technology and Web

Django 3.0 alpha1 released

A major version bump, with the largest change being built in support for ASGI, the Asynchronous Server Gateway Interface, that previously could be included via channels.

The biggest benefits ASGI offers over the traditional WSGI, is the possibility to build asynchronous operations in webapps, and leverage e.g. WebSockets to push information to the client.

Here are the in-development release notes: Django 3.0 release notes – UNDER DEVELOPMENT | Django documentation

Categories
Technology and Web

Django 1.8 released

Django 1.8 release notes

Categories
Uncategorized

Django-Formtools 1.0

In preparation of Django 1.8, the contrib package formtools was released as a stand alone package.

django-formtools 1.0

Categories
Uncategorized

What's new in Django 1.6

For the interessted:

Categories
Internet & Culture

Python and Django scale.

Scaling Django to 8 Billion Page Views | Disqus: The Official Blog.

Categories
Internet & Culture

Django Security Releases

Django 1.4.7, Django 1.5.3, and Django 1.6 beta 3

via Weblog | Django.

Categories
Technology and Web

django-braces

Nachdem die view-decorators seit der Einführung von Class Based Generic Views nicht mehr funktionieren ist ein Ersatz oft gebraucht. brack3t/django-braces fasst die gängigen Funktionen, wie beispielsweise LoginRequired oder PermissionRequired, sinnvoll zusammen.

Categories
Internet & Culture

Getting E-Mail right with Django and SES

Getting E-Mail right with Django and SES

Categories
Uncategorized

Django 1.5 released

Endlich. Nach rund 11 Monaten Arbeit – Django 1.4 wurde am 23. März vergangenen Jahres veröffentlicht – ist die nächste Version des Web-Frameworks veröffentlicht worden.

Zu den Neuerungen gehören Python3 Support, ein konfigurierbares UserModel, die Möglichkeit Subsets eines Models in die Datenbank zu speichern.

Django 1.5 Release Notes.

via Django 1.5 released | Weblog | Django.