Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
roomlist
Commits
7ce585cd
Commit
7ce585cd
authored
May 26, 2017
by
Daniel W Bond
Browse files
pep8 tweaks/fixes
parent
411821ba
Changes
6
Hide whitespace changes
Inline
Side-by-side
roomlist/accounts/adapter.py
View file @
7ce585cd
...
...
@@ -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
})
roomlist/accounts/admin.py
View file @
7ce585cd
...
...
@@ -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"
,
)
...
...
roomlist/accounts/views.py
View file @
7ce585cd
# 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
...
...
roomlist/housing/views.py
View file @
7ce585cd
...
...
@@ -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
...
...
roomlist/welcome/forms.py
View file @
7ce585cd
...
...
@@ -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
()
...
...
roomlist/welcome/views.py
View file @
7ce585cd
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment