# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-django-stronghold VERSION= 0.4.0 KEYWORDS= python VARIANTS= v12 v13 SDESC[v12]= Django app requiring login for all views (3.12) SDESC[v13]= Django app requiring login for all views (3.13) HOMEPAGE= https://github.com/mgrouchy/django-stronghold CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/ba/83/f38e0616ff658bbe62fb6e89b100ba9b19f3b351aa833dde37dcd296c8ca DISTFILE[1]= django_stronghold-0.4.0-py2.py3-none-any.whl:main DF_INDEX= 1 SPKGS[v12]= single SPKGS[v13]= single OPTIONS_AVAILABLE= PY312 PY313 OPTIONS_STANDARD= none VOPTS[v12]= PY312=ON PY313=OFF VOPTS[v13]= PY312=OFF PY313=ON DISTNAME= django_stronghold-0.4.0.dist-info GENERATED= yes [PY312].USES_ON= python:v12,wheel [PY313].USES_ON= python:v13,wheel [FILE:1925:descriptions/desc.single] [Build Status] # Stronghold Get inside your stronghold and make all your Django views default login_required Stronghold is a very small and easy to use django app that makes all your Django project default to require login for all of your views. WARNING: still in development, so some of the DEFAULTS and such will be changing without notice. ## Installation Install via pip. ```sh pip install django-stronghold ` Add stronghold to your INSTALLED_APPS in your Django settings file `python INSTALLED_APPS = ( #... 'stronghold', ) ` Then add the stronghold middleware to your MIDDLEWARE_CLASSES in your Django settings file `python MIDDLEWARE_CLASSES = ( #... 'stronghold.middleware.LoginRequiredMiddleware', ) ``` ## Usage If you followed the installation instructions now all your views are defaulting to require a login. To make a view public again you can use the public decorator provided in `stronghold.decorators` like so: ### For function based views ```python from stronghold.decorators import public @public def someview(request): # do some work #... ``` ### For class based views (decorator) ```python from django.utils.decorators import method_decorator from stronghold.decorators import public class SomeView(View): def get(self, request, *args, **kwargs): # some view logic #... @method_decorator(public) def dispatch(self, *args, **kwargs): return super(SomeView, self).dispatch(*args, **kwargs) ``` ### For class based views (mixin) ```python from stronghold.views import StrongholdPublicMixin class SomeView(StrongholdPublicMixin, View): pass ``` ## Configuration (optional) ### STRONGHOLD_DEFAULTS Use Strongholds defaults in addition to your own settings. **Default**: ```python STRONGHOLD_DEFAULTS = True ``` You can add a tuple of url regexes in your settings file with the `STRONGHOLD_PUBLIC_URLS` setting. Any url that matches against these [FILE:123:distinfo] 4127d5f9c11f6582a1c03e7758256b1fe5c872f64f212980e5ad5c67f5eeaa3d 9906 django_stronghold-0.4.0-py2.py3-none-any.whl