From b39612b4bea29087390a53f24933d33aa3bbb05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Thu, 19 Mar 2015 23:11:19 +0100 Subject: [PATCH] PEP8 Stuff --- fmartingrcom/apps/blog/admin.py | 13 ------- fmartingrcom/settings/base.py | 61 +++++++++++++++++++-------------- fmartingrcom/urls.py | 8 +++++ 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/fmartingrcom/apps/blog/admin.py b/fmartingrcom/apps/blog/admin.py index f29266b..5d6139b 100644 --- a/fmartingrcom/apps/blog/admin.py +++ b/fmartingrcom/apps/blog/admin.py @@ -1,10 +1,6 @@ from django.contrib import admin from .models import Entry, Tag -from django import forms from django.utils.translation import ugettext as _ -from django import forms -from django.db import models -from ckeditor.widgets import CKEditorWidget import reversion @@ -50,15 +46,6 @@ class EntryAdmin(reversion.VersionAdmin): obj.author = request.user super(self.__class__, self).save_model(request, obj, form, change) - class Media: - #css = { - # "all": ("ckeditor/redactor.css",) - #} - # js = ( - # "ckeditor/ckeditor.js", - # "js/wysiwyg.js", - # ) - pass admin.site.register(Entry, EntryAdmin) diff --git a/fmartingrcom/settings/base.py b/fmartingrcom/settings/base.py index 68304a5..fb7e6db 100644 --- a/fmartingrcom/settings/base.py +++ b/fmartingrcom/settings/base.py @@ -1,21 +1,14 @@ +# coding: utf-8 """ Django settings for fmartingrcom project. - -For more information on this file, see -https://docs.djangoproject.com/en/1.6/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/1.6/ref/settings/ """ -# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +# python import os + + BASE_DIR = os.path.dirname(os.path.dirname(__file__)) - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/ - # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '0123456789' @@ -127,6 +120,8 @@ COMPRESS_PRECOMPILERS = ( # # MEDIA FILES # +MEDIA_URL = '/media/' + CKEDITOR_UPLOAD_PATH = 'ckeditor/' CKEDITOR_CONFIGS = { @@ -134,20 +129,24 @@ CKEDITOR_CONFIGS = { 'toolbar': 'Standard', 'width': '100%', 'stylesSet': ( - { 'name': 'Code', - 'element': 'code', + { + 'name': 'Code', + 'element': 'code', }, - { 'name': 'Code block', - 'element': 'pre', - 'attributes': { 'class': 'prettyprint' } + { + 'name': 'Code block', + 'element': 'pre', + 'attributes': {'class': 'prettyprint'} }, - { 'name': 'Code block (Bash)', - 'element': 'pre', - 'attributes': { 'class': 'lang-bash prettyprint' } + { + 'name': 'Code block (Bash)', + 'element': 'pre', + 'attributes': {'class': 'lang-bash prettyprint'} }, - { 'name': 'Code block (Python)', - 'element': 'pre', - 'attributes': { 'class': 'lang-python prettyprint' } + { + 'name': 'Code block (Python)', + 'element': 'pre', + 'attributes': {'class': 'lang-python prettyprint'} }, ) }, @@ -166,9 +165,21 @@ TEMPLATE_LOADERS = ( TEMPLATE_DIRS = ( '{}/themes/v1/templates/'.format(BASE_DIR), ) -from django_jinja.base import DEFAULT_EXTENSIONS -JINJA2_EXTENSIONS = DEFAULT_EXTENSIONS + [ - 'compressor.contrib.jinja2ext.CompressorExtension', + +JINJA2_EXTENSIONS = [ + "jinja2.ext.do", + "jinja2.ext.loopcontrols", + "jinja2.ext.with_", + "jinja2.ext.i18n", + "jinja2.ext.autoescape", + "django_jinja.builtins.extensions.CsrfExtension", + "django_jinja.builtins.extensions.CacheExtension", + "django_jinja.builtins.extensions.TimezoneExtension", + "django_jinja.builtins.extensions.UrlsExtension", + "django_jinja.builtins.extensions.StaticFilesExtension", + "django_jinja.builtins.extensions.DjangoFiltersExtension", + "django_jinja.builtins.extensions.DjangoExtraFiltersExtension", + "compressor.contrib.jinja2ext.CompressorExtension", ] TEMPLATE_CONTEXT_PROCESSORS = ( diff --git a/fmartingrcom/urls.py b/fmartingrcom/urls.py index acf1645..a7056ce 100644 --- a/fmartingrcom/urls.py +++ b/fmartingrcom/urls.py @@ -19,3 +19,11 @@ urlpatterns = patterns('', url(r'^blog/', include('fmartingrcom.apps.blog.urls', namespace='blog')), url(r'^$', include('fmartingrcom.apps.homepage.urls', namespace='home')), ) + + +from django.conf import settings +from django.conf.urls.static import static + +if settings.DEBUG: + urlpatterns += static(settings.MEDIA_URL, + document_root=settings.MEDIA_ROOT)