Admin fixes and CSRF disable

This commit is contained in:
root 2011-05-30 07:01:45 +00:00
parent ea644a0670
commit edf59865d6
3 changed files with 10 additions and 6 deletions

View file

@ -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

View file

@ -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'),
) )

View file

@ -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()