A Django application with helper functions and utilities.
- Python 3.6 or later
- Django 2.2, 3.2 or 4.2
Installing from PyPI is as easy as doing:
pip install django-epfl-misc
from django_epflmisc.decorators import superuser_required_or_403
@superuser_required_or_403()
def my_view(request):
# I can assume now that the view is only accessible as a superuser.
The cache system requires a small amount of setup. Namely, you have to tell it where your cached data should live – whether in a database, on the filesystem or directly in memory.
from django_epflmisc.decorators import cache_anonymous_user
@cache_anonymous_user(60 * 15)
def my_view(request):
# I can assume now that the view is cached for anonymous users.
The MIT License (MIT)
Copyright (c) 2021-2023 ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland.