Commit 7ce585cd authored by Daniel W Bond's avatar Daniel W Bond

pep8 tweaks/fixes

parent 411821ba
......@@ -67,9 +67,8 @@ class AccountAdapter(DefaultSocialAccountAdapter):
raise ImmediateHttpResponse(social_redirect)
else:
messages.add_message(request, messages.ERROR, error_message)
update_redirect = HttpResponseRedirect(reverse('update_student', kwargs={
'slug': request.user.username,
}))
update_redirect = HttpResponseRedirect(reverse('update_student',
kwargs={'slug': request.user.username, }))
raise ImmediateHttpResponse(update_redirect)
......@@ -133,7 +132,7 @@ class RemoveSocialConfirmationView(LoginRequiredMixin, FormView):
social_account_removed.send(sender=SocialAccount,
request=request,
socialaccount=social_account)
message = "%s has been successfully disconnected." % branding
message = "%s has been successfully disconnected." % branding
messages.add_message(self.request,
messages.SUCCESS,
message)
......@@ -149,4 +148,4 @@ class RemoveSocialConfirmationView(LoginRequiredMixin, FormView):
def get_success_url(self):
return reverse('update_student',
kwargs={'slug': self.request.user.username})
kwargs={'slug': self.request.user.username})
......@@ -24,6 +24,7 @@ class StudentAdmin(admin.ModelAdmin):
get_first_major.short_description = 'Major'
# we're not going to give the option to sort by major for now
class MajorAdmin(admin.ModelAdmin):
list_display = ("name", "get_major_num", )
......
# standard library imports
from __future__ import absolute_import, print_function
import random
from distutils.util import strtobool
from collections import OrderedDict
from itertools import groupby
import re
# core django imports
from django.http import HttpResponseForbidden, HttpResponseRedirect, Http404
from django.views.generic import CreateView, ListView, DetailView, FormView, DeleteView
......@@ -12,14 +10,10 @@ from django.core.urlresolvers import reverse
from django.contrib import messages
from django.utils.safestring import mark_safe
from django.forms.widgets import HiddenInput
from django.conf import settings
from django.template.loader import get_template
from django.core.mail import EmailMultiAlternatives, get_connection
from django.template import Context
from django.core.mail import get_connection
from django.core.exceptions import ObjectDoesNotExist
# third party imports
from braces.views import LoginRequiredMixin, FormValidMessageMixin
from cas.views import login as cas_login
from ratelimit.decorators import ratelimit
# imports from your apps
from .models import Student, Major, Confirmation
......@@ -390,6 +384,7 @@ class DeleteStudent(FormView):
def get_success_url(self):
return reverse('homepage')
# majors pages
class ListMajors(ListView):
model = Major
......
......@@ -33,7 +33,7 @@ class ListBuildings(ListView):
for neighbourhood in neighbourhoods:
# the tuple matrix was necessary because what we'll render for humans
# is not the string for filtering in the database
buildings_by_neighbourhood[neighbourhood[1]] = Building.objects.filter(neighbourhood=neighbourhood[0]).order_by('name')
buildings_by_neighbourhood[neighbourhood[1]] = Building.objects.filter(neighbourhood=neighbourhood[0]).order_by('name')
# this whole process is done so we don't have template code in triplicate
# for each neighbourhood
context['buildings_by_neighbourhood'] = buildings_by_neighbourhood
......
......@@ -3,6 +3,7 @@ from __future__ import absolute_import, print_function
# core django imports
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext as _
# third party imports
from multiselectfield import MultiSelectFormField
# imports from your apps
......@@ -29,7 +30,8 @@ class WelcomePrivacyForm(forms.ModelForm):
if self.instance.recent_changes() > 2:
self.fields['room'].widget = forms.widgets.HiddenInput()
else:
self.fields['room'] = SelectRoomField(queryset=Room.objects.all(), required=False)
self.fields['room'] = SelectRoomField(queryset=Room.objects.all(),
required=False)
on_campus = BooleanRadioField()
......
......@@ -11,7 +11,7 @@ from django.contrib import messages
from braces.views import LoginRequiredMixin
from ratelimit.decorators import ratelimit
# imports from your apps
from accounts.models import Student, Confirmation, Major
from accounts.models import Confirmation, Major
from core.utils import create_email, no_nums, get_semester
from housing.models import Room
from .forms import (WelcomeNameForm, WelcomeMajorForm,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment