david / django-modelviews
Backup of an old repository with useful ideas. Initial goal: integrating REST to django admin (class-based views).
Clone this repository (size: 85.8 KB): HTTPS / SSH
$ hg clone http://code.welldev.org/django-modelviews
| commit 46: | ce94cd50e1ba |
| parent 45: | 89bfa8b44768 |
| branch: | default |
Move authentication backends to authentications file
2 years ago
Changed (Δ684 bytes):
raw changeset »
generic/authentications.py (9 lines added, 0 lines removed)
generic/rest_views.py (0 lines added, 10 lines removed)
tests/urls.py (2 lines added, 0 lines removed)
Up to file-list generic/authentications.py:
1 |
def django_authentication(request, **kwargs): |
|
2 |
return request.user.is_authenticated() |
|
3 |
||
4 |
def django_superuser_authentication(request, **kwargs): |
|
5 |
return request.user.is_superuser |
|
6 |
||
7 |
def django_staff_authentication(request, **kwargs): |
|
8 |
return request.user.is_staff |
|
9 |
Up to file-list generic/rest_views.py:
| … | … | @@ -9,16 +9,6 @@ try: |
9 |
9 |
except ImportError: |
10 |
10 |
from compatability import BaseView |
11 |
11 |
|
12 |
def django_authentication(request, **kwargs): |
|
13 |
return request.user.is_authenticated() |
|
14 |
||
15 |
def django_superuser_authentication(request, **kwargs): |
|
16 |
return request.user.is_superuser |
|
17 |
||
18 |
def django_staff_authentication(request, **kwargs): |
|
19 |
return request.user.is_staff |
|
20 |
||
21 |
||
22 |
12 |
|
23 |
13 |
class ModelView(BaseView): |
24 |
14 |
""" |
Up to file-list tests/urls.py:
1 |
1 |
from django.conf.urls.defaults import * |
2 |
2 |
from test_modelview.models import Article, Comment |
3 |
3 |
from django_modelview.generic.rest_views import * |
4 |
from django_modelview.generic.authentications import django_authentication, \ |
|
5 |
django_superuser_authentication, django_staff_authentication |
|
4 |
6 |
|
5 |
7 |
responders = (HtmlResponder, JsonResponder, XmlResponder, |
6 |
8 |
YamlResponder, AtomResponder, RssResponder) |
