Ravenports generated: 02 Jul 2018 06:37
[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.0
5 KEYWORDS=               python
6 VARIANTS=               py36 py37
7 SDESC[py36]=            Django app requiring login for all views (PY 36)
8 SDESC[py37]=            Django app requiring login for all views (PY 37)
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.0.tar.gz:main
15 DF_INDEX=               1
16 SPKGS[py36]=            single
17 SPKGS[py37]=            single
18
19 OPTIONS_AVAILABLE=      PY36 PY37
20 OPTIONS_STANDARD=       none
21 VOPTS[py36]=            PY36=ON PY37=OFF
22 VOPTS[py37]=            PY36=OFF PY37=ON
23
24 DISTNAME=               django-stronghold-0.3.0
25
26 GENERATED=              yes
27
28 [PY36].USES_ON=                         python:py36
29
30 [PY37].USES_ON=                         python:py37
31
32 [FILE:2121:descriptions/desc.single]
33 .. figure::
34 https://travis-ci.org/mgrouchy/django-stronghold.png?branch=master
35    :alt: travis
36
37 Stronghold
38 ==========
39
40 Get inside your stronghold and make all your Django views default
41 login\_required
42
43 Stronghold is a very small and easy to use django app that makes all
44 your Django project default to require login for all of your views.
45
46 WARNING: still in development, so some of the DEFAULTS and such will be
47 changing without notice.
48
49 Installation
50 ------------
51
52 Install via pip.
53
54 .. code:: sh
55
56     pip install django-stronghold
57
58 Add stronghold to your INSTALLED\_APPS in your Django settings file
59
60 .. code:: python
61
62
63     INSTALLED_APPS = (
64         #...
65         'stronghold',
66     )
67
68 Then add the stronghold middleware to your MIDDLEWARE\_CLASSES in your
69 Django settings file
70
71 .. code:: python
72
73     MIDDLEWARE_CLASSES = (
74         #...
75         'stronghold.middleware.LoginRequiredMiddleware',
76     )
77
78 Usage
79 -----
80
81 If you followed the installation instructions now all your views are
82 defaulting to require a login. To make a view public again you can use
83 the public decorator provided in ``stronghold.decorators`` like so:
84
85 For function based views
86 ~~~~~~~~~~~~~~~~~~~~~~~~
87
88 .. code:: python
89
90     from stronghold.decorators import public
91
92
93     @public
94     def someview(request):
95         # do some work
96         #...
97
98 for class based views (decorator)
99 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
100
101 .. code:: python
102
103     from django.utils.decorators import method_decorator
104     from stronghold.decorators import public
105
106
107     class SomeView(View):
108         def get(self, request, *args, **kwargs):
109             # some view logic
110             #...
111
112         @method_decorator(public)
113         def dispatch(self, *args, **kwargs):
114             return super(SomeView, self).dispatch(*args, **kwargs)
115
116 for class based views (mixin)
117 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
118
119 .. code:: python
120
121     from stronghold import StrongholdPublicMixin
122
123     class SomeView(StrongholdPublicMixin, View):
124         pass
125
126 Configuration (optional)
127 ------------------------
128
129 STRONGHOLD\_DEFAULTS
130 ~~~~~~~~~~~~~~~~~~~~
131
132 Use Strongholds defaults in addition to your own settings.
133
134
135
136 [FILE:109:distinfo]
137 9ffb2d5d61945b67061c60a39ec740a9670dda89d96b3c7ef890c1a1a08fd18a         7882 django-stronghold-0.3.0.tar.gz
138