Skip to main content

A Django application with helper functions and utilities.

Project description

django-epfl-misc

Build Status Coverage Status PyPI version PyPI Python version

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-epfl-misc-1.1.0.tar.gz (6.7 kB view hashes)

Uploaded Source

Built Distribution

django_epfl_misc-1.1.0-py3-none-any.whl (7.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page