mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 08:02:54 +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):
|
||||
allowed_methods = ('GET', 'POST')
|
||||
fields = ('title', 'content',)
|
||||
exclude = ('id', re.compile(r'^private_'))
|
||||
model = Snippet
|
||||
|
||||
def content_size(self, blogpost):
|
||||
return len(blogpost.content)
|
||||
|
||||
def read(self, request, secret_id):
|
||||
post = Snippet.objects.get(secret_id=secret_id)
|
||||
return post
|
||||
|
|
|
@ -79,6 +79,14 @@ LOGIN_REDIRECT_URL = '/'
|
|||
# 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 = (
|
||||
os.path.join(PROJECT_DIR, PROJECT_MODULE_NAME, 'templates'),
|
||||
)
|
||||
|
|
|
@ -16,7 +16,7 @@ urlpatterns = patterns('',
|
|||
|
||||
# Bla
|
||||
(r'^i18n/', include('django.conf.urls.i18n')),
|
||||
(r'^admin/(.*)', include(admin.site.urls)),
|
||||
(r'^admin/', include(admin.site.urls)),
|
||||
|
||||
# API
|
||||
url(r'^api/(?P<secret_id>[^/]+)/$', snippet_resource),
|
||||
|
|
Loading…
Reference in a new issue