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
72acad0a
Commit
72acad0a
authored
Oct 15, 2016
by
Daniel W Bond
Browse files
added else block to try/except; commented out print lines
parent
d0ab153e
Changes
1
Hide whitespace changes
Inline
Side-by-side
roomlist/settings/views.py
View file @
72acad0a
...
...
@@ -76,20 +76,23 @@ class RedirectSlug(RedirectView):
# sending the student to-- this is just about changing the url
def
get_redirect_url
(
self
,
*
args
,
**
kwargs
):
current_url
=
self
.
request
.
get_full_path
()
# print(self.request)
# [u'', u'gmason']
slug
=
current_url
.
split
(
'/'
)[
1
]
print
(
slug
)
#
print(slug)
try
:
print
(
'trying student'
)
#
print('trying student')
student
=
Student
.
objects
.
get
(
user__username
=
slug
)
return
reverse
(
'detail_student'
,
kwargs
=
{
'slug'
:
slug
})
except
ObjectDoesNotExist
:
print
(
'trying major'
)
#
print('trying major')
try
:
major
=
Major
.
objects
.
get
(
slug
=
slug
)
return
reverse
(
'detail_major'
,
kwargs
=
{
'slug'
:
slug
})
except
ObjectDoesNotExist
:
raise
Http404
else
:
return
Http404
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