pep8 fixes

This commit is contained in:
Thomas Waldmann 2013-09-29 01:21:44 +02:00
parent 0093aab667
commit ac4860f54a
12 changed files with 31 additions and 34 deletions

View File

@ -3,8 +3,8 @@
from django import forms from django import forms
from django.contrib.auth.models import User from django.contrib.auth.models import User
class UserProfileForm(forms.ModelForm): class UserProfileForm(forms.ModelForm):
class Meta: class Meta:
model = User model = User
fields = ['first_name', 'last_name', ] fields = ['first_name', 'last_name', ]

View File

@ -1,14 +1,12 @@
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from accounts.views import ( from accounts.views import UserProfileView
UserProfileView
)
from django.contrib.auth.views import password_change from django.contrib.auth.views import password_change
urlpatterns = patterns('', urlpatterns = patterns(
'',
url(r'^profile/', UserProfileView.as_view(), name="account_profile"), url(r'^profile/', UserProfileView.as_view(), name="account_profile"),
url(r'^change_pw/', password_change, { url(r'^change_pw/', password_change, {
'template_name': 'registration/password_change.html', 'template_name': 'registration/password_change.html',
'post_change_redirect': '/account/profile/', 'post_change_redirect': '/account/profile/', },
}, name="password_change"), )
name="password_change"),
)

View File

@ -31,4 +31,3 @@ class PasswordChangeView(TemplateView):
context = super(PasswordChangeView, self).get_context_data(*args, **kwargs) context = super(PasswordChangeView, self).get_context_data(*args, **kwargs)
context['nav_change_password'] = True context['nav_change_password'] = True
return context return context

View File

@ -1,4 +1,5 @@
from main.models import * from main.models import *
from django.contrib import admin from django.contrib import admin
admin.site.register(Host) admin.site.register(Host)

View File

@ -2,8 +2,8 @@
from django import forms from django import forms
from main.models import Host from main.models import Host
class HostForm(forms.ModelForm): class HostForm(forms.ModelForm):
class Meta: class Meta:
model = Host model = Host
fields = ['fqdn', 'comment', 'update_secret'] fields = ['fqdn', 'comment', 'update_secret']

View File

@ -17,7 +17,6 @@ class Host(models.Model):
return u"%s - %s" % (self.fqdn, self.comment) return u"%s - %s" % (self.fqdn, self.comment)
class HostForm(ModelForm): class HostForm(ModelForm):
class Meta: class Meta:
model = Host model = Host

View File

@ -55,6 +55,7 @@ class OverviewView(CreateView):
context['hosts'] = Host.objects.filter(created_by=self.request.user) context['hosts'] = Host.objects.filter(created_by=self.request.user)
return context return context
class HostView(UpdateView): class HostView(UpdateView):
model = Host model = Host
template_name = "main/host.html" template_name = "main/host.html"
@ -87,6 +88,7 @@ class HostView(UpdateView):
context['hosts'] = Host.objects.filter(created_by=self.request.user) context['hosts'] = Host.objects.filter(created_by=self.request.user)
return context return context
class DeleteHostView(DeleteView): class DeleteHostView(DeleteView):
model = Host model = Host
template_name = "main/delete_host.html" template_name = "main/delete_host.html"
@ -110,5 +112,3 @@ class DeleteHostView(DeleteView):
context['nav_overview'] = True context['nav_overview'] = True
context['hosts'] = Host.objects.filter(created_by=self.request.user) context['hosts'] = Host.objects.filter(created_by=self.request.user)
return context return context

View File

@ -1,9 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django.conf import settings from django.conf import settings
def add_settings(request): def add_settings(request):
context = {} context = {}
context['WWW_IPV4_HOST'] = settings.WWW_IPV4_HOST context['WWW_IPV4_HOST'] = settings.WWW_IPV4_HOST
context['WWW_IPV6_HOST'] = settings.WWW_IPV6_HOST context['WWW_IPV6_HOST'] = settings.WWW_IPV6_HOST
return context return context

View File

@ -20,7 +20,7 @@ DATABASES = {
'USER': '', 'USER': '',
'PASSWORD': '', 'PASSWORD': '',
'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP.
'PORT': '', # Set to empty string for default. 'PORT': '' # Set to empty string for default.
} }
} }
@ -211,4 +211,3 @@ try:
from .local_settings import * from .local_settings import *
except ImportError: except ImportError:
pass pass

View File

@ -4,7 +4,8 @@ from django.views.generic import TemplateView
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns(
'',
url(r'^accounts/', include('registration.backends.default.urls')), url(r'^accounts/', include('registration.backends.default.urls')),
url(r'^account/', include('accounts.urls')), url(r'^account/', include('accounts.urls')),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
@ -15,5 +16,4 @@ from django.conf import settings
if settings.DEBUG: if settings.DEBUG:
urlpatterns += patterns('django.contrib.staticfiles.views', urlpatterns += patterns('django.contrib.staticfiles.views',
url(r'^static/(?P<path>.*)$', 'serve'), url(r'^static/(?P<path>.*)$', 'serve'), )
)

View File

@ -30,4 +30,5 @@ pep8ignore =
*.py E124 # closing bracket does not match visual indentation (behaves strange!?) *.py E124 # closing bracket does not match visual indentation (behaves strange!?)
*.py E125 # continuation line does not distinguish itself from next logical line (difficult to avoid!) *.py E125 # continuation line does not distinguish itself from next logical line (difficult to avoid!)
docs/conf.py ALL # sphinx stuff, automatically generated, don't check this docs/conf.py ALL # sphinx stuff, automatically generated, don't check this
migrations/*.py ALL # autogenerated by South