Chris Lamb

django-validate-model-attribute-assignment

BlogProjectsAbout

View all my projects »

Prevent typos and other errors when assigning attributes to Django model instances.


Ever done the following?

>>> user = User.objects.get(pk=102)
>>> user.superuser = True
>>> user.save()

# Argh, why is this user now not a superuser...

With this package:

>>> user = User.objects.get(pk=102)
>>> user.superuser = True
...
ValueError: Refusing to set unknown attribute 'superuser' on auth.User instance. (Did you misspell 'username', 'first_name', 'last_name', 'is_active', 'email', 'is_superuser', 'is_staff', 'last_login', 'password', 'id', 'date_joined')

If you are looking for a highly experienced full-stack Django developer with a track record of producing high-quality and maintaininable code, please get in touch.

You can install django-validate-model-attribute-assignment from PyPI:

$ pip install django-validate-model-attribute-assignment
… or by adding django-validate-model-attribute-assignment to your requirements.txt and re-running pip install -r requirements.txt.

You can browse the source tree, create or file bugs or download the code from Git:

$ git clone https://github.com/lamby/django-validate-model-attribute-assignment.git

django-validate-model-attribute-assignment is released under the MIT license.

View all my projects »