mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-23 11:56:36 +11:00
Admin fixes and CSRF disable
This commit is contained in:
parent
ea644a0670
commit
edf59865d6
3 changed files with 10 additions and 6 deletions
|
@ -7,12 +7,8 @@ from pastebin.apps.dpaste.models import Snippet
|
||||||
class SnippetHandler(AnonymousBaseHandler):
|
class SnippetHandler(AnonymousBaseHandler):
|
||||||
allowed_methods = ('GET', 'POST')
|
allowed_methods = ('GET', 'POST')
|
||||||
fields = ('title', 'content',)
|
fields = ('title', 'content',)
|
||||||
exclude = ('id', re.compile(r'^private_'))
|
|
||||||
model = Snippet
|
model = Snippet
|
||||||
|
|
||||||
def content_size(self, blogpost):
|
|
||||||
return len(blogpost.content)
|
|
||||||
|
|
||||||
def read(self, request, secret_id):
|
def read(self, request, secret_id):
|
||||||
post = Snippet.objects.get(secret_id=secret_id)
|
post = Snippet.objects.get(secret_id=secret_id)
|
||||||
return post
|
return post
|
||||||
|
|
|
@ -79,6 +79,14 @@ LOGIN_REDIRECT_URL = '/'
|
||||||
# Templates
|
# Templates
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
|
||||||
|
MIDDLEWARE_CLASSES = (
|
||||||
|
'pastebin.disable.DisableCSRF',
|
||||||
|
'django.middleware.common.CommonMiddleware',
|
||||||
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
|
)
|
||||||
|
|
||||||
TEMPLATE_DIRS = (
|
TEMPLATE_DIRS = (
|
||||||
os.path.join(PROJECT_DIR, PROJECT_MODULE_NAME, 'templates'),
|
os.path.join(PROJECT_DIR, PROJECT_MODULE_NAME, 'templates'),
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,11 +16,11 @@ urlpatterns = patterns('',
|
||||||
|
|
||||||
# Bla
|
# Bla
|
||||||
(r'^i18n/', include('django.conf.urls.i18n')),
|
(r'^i18n/', include('django.conf.urls.i18n')),
|
||||||
(r'^admin/(.*)', include(admin.site.urls)),
|
(r'^admin/', include(admin.site.urls)),
|
||||||
|
|
||||||
# API
|
# API
|
||||||
url(r'^api/(?P<secret_id>[^/]+)/$', snippet_resource),
|
url(r'^api/(?P<secret_id>[^/]+)/$', snippet_resource),
|
||||||
url(r'^api/$', snippet_resource),
|
url(r'^api/$', snippet_resource),
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns += staticfiles_urlpatterns()
|
urlpatterns += staticfiles_urlpatterns()
|
||||||
|
|
Loading…
Reference in a new issue