djangoepflmisc 1.1.0
django-epfl-misc
A Django application with helper functions and utilities.
Requirements
Python 3.6 or later
Django 2.2, 3.2 or 4.2
Installation
Installing from PyPI is as easy as doing:
pip install django-epfl-misc
Documentation
Auth
superuser_required_or_403()
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.
Cache
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.
See Django's cache framework
cache_anonymous_user(timeout, cache="default")
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.
License
The MIT License (MIT)
Copyright (c) 2021-2023 ECOLE POLYTECHNIQUE FEDERALE DE LAUSANNE, Switzerland.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.