summaryrefslogtreecommitdiff
path: root/devel/views.py
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2010-08-28 11:37:39 -0500
committerDan McGee <dan@archlinux.org>2010-08-28 11:41:19 -0500
commitd57696c8013d78f017972ae72efeeb441c954cb2 (patch)
tree5e9d9a70cda9a40b56dec08a1caf5b1e3e36edee /devel/views.py
parent7dcdb0a31519c038e25436b49a60b9e54a41372b (diff)
PyLint suggested cleanups
We had a bunch of extra imports, non-conventional variable names, spacing issues, etc. that were relatively low-hanging fruit to clean up. Fix them and make the code a bit cleaner in the process. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'devel/views.py')
-rw-r--r--devel/views.py34
1 files changed, 21 insertions, 13 deletions
diff --git a/devel/views.py b/devel/views.py
index 192a4572..baa5fd6c 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -6,19 +6,16 @@ from django.contrib.sites.models import Site
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.mail import send_mail
-from django.db.models import Q
from django.views.decorators.cache import never_cache
from main.models import Package, Todolist, TodolistPkg
from main.models import Arch, Repo
-from main.models import UserProfile, News
+from main.models import UserProfile
from main.models import Mirror
from packages.models import PackageRelation
import random
from string import ascii_letters, digits
-pwletters = ascii_letters + digits
-
@login_required
@never_cache
@@ -30,13 +27,16 @@ def index(request):
todopkgs = TodolistPkg.objects.select_related(
'pkg', 'pkg__arch', 'pkg__repo').filter(complete=False)
- todopkgs = todopkgs.filter(pkg__pkgbase__in=inner_q).order_by('list__name', 'pkg__pkgname')
+ todopkgs = todopkgs.filter(pkg__pkgbase__in=inner_q).order_by(
+ 'list__name', 'pkg__pkgname')
+ maintainers = User.objects.filter(is_active=True).order_by(
+ 'first_name', 'last_name')
page_dict = {
'todos': Todolist.objects.incomplete().order_by('-date_added'),
'repos': Repo.objects.all(),
'arches': Arch.objects.all(),
- 'maintainers': User.objects.filter(is_active=True).order_by('first_name', 'last_name'),
+ 'maintainers': maintainers,
'flagged' : flagged,
'todopkgs' : todopkgs,
}
@@ -48,9 +48,9 @@ def index(request):
def change_notify(request):
maint = User.objects.get(username=request.user.username)
notify = request.POST.get('notify', 'no')
- pf = maint.get_profile()
- pf.notify = (notify == 'yes')
- pf.save()
+ prof = maint.get_profile()
+ prof.notify = (notify == 'yes')
+ prof.save()
return HttpResponseRedirect('/devel/')
class ProfileForm(forms.Form):
@@ -98,6 +98,7 @@ class NewUserForm(forms.ModelForm):
def save(self):
profile = forms.ModelForm.save(self, False)
+ pwletters = ascii_letters + digits
pw = ''.join([random.choice(pwletters) for i in xrange(8)])
user = User.objects.create_user(username=self.cleaned_data['username'],
email=self.cleaned_data['email'], password=pw)
@@ -125,14 +126,21 @@ def new_user_form(request):
form = NewUserForm(request.POST)
if form.is_valid():
form.save()
- return HttpResponseRedirect('/admin/auth/user/%d/' %form.instance.user.id)
+ return HttpResponseRedirect('/admin/auth/user/%d/' % \
+ form.instance.user.id)
else:
form = NewUserForm()
- return render_to_response('general_form.html', RequestContext(
- request, {'description': '''A new user will be created with the
+
+ context = {
+ 'description': '''A new user will be created with the
following properties in their profile. A random password will be
generated and the user will be e-mailed with their account details
n plaintext.''',
- 'form': form, 'title': 'Create User', 'submit_text': 'Create User'}))
+ 'form': form,
+ 'title': 'Create User',
+ 'submit_text': 'Create User'
+ }
+ return render_to_response('general_form.html',
+ RequestContext(request, context))
# vim: set ts=4 sw=4 et: