Merge pull request #122 from slafs/linting

add flake8 and setup.cfg for linting
This commit is contained in:
Daniel Greenfeld 2014-08-16 14:58:12 -03:00
commit b15e8f91f9
8 changed files with 17 additions and 14 deletions

View File

@ -26,6 +26,7 @@ Henrique G. G. Pereira / @ikkebr
Travis McNeill / gh: Tavistock / @tavistock_esq
Matt Linares
Russell Davies
Sławek Ehlert / @slafs
* Possesses commit rights

View File

@ -1,3 +1,4 @@
# Test dependencies go here.
-r base.txt
coverage==3.7.1
flake8==2.2.2

View File

@ -0,0 +1,4 @@
[flake8]
#ignore = E265
max-line-length = 120
exclude = .tox,.git,*/migrations/*,*/static/CACHE/*,docs

View File

@ -23,7 +23,7 @@ setup(
],
include_package_data=True,
install_requires=[
'Django>=1.6.1',
'Django>=1.6.5',
],
zip_safe=False,
scripts=['{{ cookiecutter.repo_name }}/manage.py'],

View File

@ -173,9 +173,9 @@ class Common(Configuration):
)
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
)
# See: http://django-crispy-forms.readthedocs.org/en/latest/install.html#template-packs
CRISPY_TEMPLATE_PACK = 'bootstrap3'
@ -270,7 +270,6 @@ class Common(Configuration):
}
########## END LOGGING CONFIGURATION
########## Your common stuff: Below this line define 3rd party libary settings
@ -364,7 +363,7 @@ class Production(Common):
AWS_EXPIREY = 60 * 60 * 24 * 7
AWS_HEADERS = {
'Cache-Control': 'max-age=%d, s-maxage=%d, must-revalidate' % (AWS_EXPIREY,
AWS_EXPIREY)
AWS_EXPIREY)
}
# See: https://docs.djangoproject.com/en/dev/ref/settings/#static-url
@ -373,7 +372,7 @@ class Production(Common):
########## EMAIL
DEFAULT_FROM_EMAIL = values.Value(
'{{cookiecutter.project_name}} <noreply@{{cookiecutter.domain_name}}>')
'{{cookiecutter.project_name}} <noreply@{{cookiecutter.domain_name}}>')
EMAIL_HOST = values.Value('smtp.sendgrid.com')
EMAIL_HOST_PASSWORD = values.SecretValue(environ_prefix="", environ_name="SENDGRID_PASSWORD")
EMAIL_HOST_USER = values.SecretValue(environ_prefix="", environ_name="SENDGRID_USERNAME")
@ -405,4 +404,3 @@ class Production(Common):
########## END CACHING
########## Your production stuff: Below this line define 3rd party libary settings

View File

@ -11,7 +11,7 @@ from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$',
url(r'^$', # noqa
TemplateView.as_view(template_name='pages/home.html'),
name="home"),
url(r'^about/$',
@ -31,4 +31,3 @@ urlpatterns = patterns('',
# Your stuff: custom urls go here
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -4,7 +4,7 @@ from django.conf.urls import patterns, url
from users import views
urlpatterns = patterns('',
# URL pattern for the UserListView
# URL pattern for the UserListView # noqa
url(
regex=r'^$',
view=views.UserListView.as_view(),
@ -28,4 +28,4 @@ urlpatterns = patterns('',
view=views.UserUpdateView.as_view(),
name='update'
),
)
)

View File

@ -30,7 +30,7 @@ class UserRedirectView(LoginRequiredMixin, RedirectView):
def get_redirect_url(self):
return reverse("users:detail",
kwargs={"username": self.request.user.username})
kwargs={"username": self.request.user.username})
class UserUpdateView(LoginRequiredMixin, UpdateView):
@ -43,7 +43,7 @@ class UserUpdateView(LoginRequiredMixin, UpdateView):
# send the user back to their own page after a successful update
def get_success_url(self):
return reverse("users:detail",
kwargs={"username": self.request.user.username})
kwargs={"username": self.request.user.username})
def get_object(self):
# Only get the User record for the user making the request