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

pep8 tweaks/fixes

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