Ravenports generated: 20 Apr 2020 15:00
[ravenports.git] / bucket_5B / python-django-stronghold
1 # Buildsheet autogenerated by ravenadm tool -- Do not edit.
2
3 NAMEBASE=               python-django-stronghold
4 VERSION=                0.3.2
5 KEYWORDS=               python
6 VARIANTS=               py38 py37
7 SDESC[py37]=            Django app requiring login for all views (PY37)
8 SDESC[py38]=            Django app requiring login for all views (PY38)
9 HOMEPAGE=               https://github.com/mgrouchy/django-stronghold
10 CONTACT=                Python_Automaton[python@ironwolf.systems]
11
12 DOWNLOAD_GROUPS=        main
13 SITES[main]=            PYPI/d/django-stronghold
14 DISTFILE[1]=            django-stronghold-0.3.2.tar.gz:main
15 DF_INDEX=               1
16 SPKGS[py37]=            single
17 SPKGS[py38]=            single
18
19 OPTIONS_AVAILABLE=      PY38 PY37
20 OPTIONS_STANDARD=       none
21 VOPTS[py37]=            PY38=OFF PY37=ON
22 VOPTS[py38]=            PY38=ON PY37=OFF
23
24 DISTNAME=               django-stronghold-0.3.2
25
26 GENERATED=              yes
27
28 [PY37].USES_ON=                         python:py37
29
30 [PY38].USES_ON=                         python:py38
31
32 [FILE:1986:descriptions/desc.single]
33 [![Build Status]](https://travis-ci.org/mgrouchy/django-stronghold)
34
35 # Stronghold
36
37 Get inside your stronghold and make all your Django views default
38 login_required
39
40 Stronghold is a very small and easy to use django app that makes all your
41 Django project default to require login for all of your views.
42
43 WARNING: still in development, so some of the DEFAULTS and such will be
44 changing without notice.
45
46 ## Installation
47
48 Install via pip.
49
50 ```sh
51 pip install django-stronghold
52 ```
53
54 Add stronghold to your INSTALLED_APPS in your Django settings file
55
56 ```python
57
58 INSTALLED_APPS = (
59     #...
60     'stronghold',
61 )
62 ```
63
64 Then add the stronghold middleware to your MIDDLEWARE_CLASSES in your
65 Django settings file
66
67 ```python
68 MIDDLEWARE_CLASSES = (
69     #...
70     'stronghold.middleware.LoginRequiredMiddleware',
71 )
72
73 ```
74
75 ## Usage
76
77 If you followed the installation instructions now all your views are
78 defaulting to require a login.
79 To make a view public again you can use the public decorator provided in
80 `stronghold.decorators` like so:
81
82 ### For function based views
83
84 ```python
85 from stronghold.decorators import public
86
87 @public
88 def someview(request):
89         # do some work
90         #...
91
92 ```
93
94 ### For class based views (decorator)
95
96 ```python
97 from django.utils.decorators import method_decorator
98 from stronghold.decorators import public
99
100 class SomeView(View):
101         def get(self, request, *args, **kwargs):
102                 # some view logic
103                 #...
104
105         @method_decorator(public)
106         def dispatch(self, *args, **kwargs):
107         return super(SomeView, self).dispatch(*args, **kwargs)
108 ```
109
110 ### For class based views (mixin)
111
112 ```python
113 from stronghold.views import StrongholdPublicMixin
114
115 class SomeView(StrongholdPublicMixin, View):
116         pass
117 ```
118
119 ## Configuration (optional)
120
121 ### STRONGHOLD_DEFAULTS
122
123 Use Strongholds defaults in addition to your own settings.
124
125 **Default**:
126
127 ```python
128 STRONGHOLD_DEFAULTS = True
129 ```
130
131 You can add a tuple of url regexes in your settings file with the
132 `STRONGHOLD_PUBLIC_URLS` setting. Any url that matches against these
133
134
135 [FILE:109:distinfo]
136 6abab3641369d9776629b974ba17af4f6a1b3144c268394aaf3a08cdc9e7d1e8         7086 django-stronghold-0.3.2.tar.gz
137