Commit 72acad0a authored by Daniel W Bond's avatar Daniel W Bond
Browse files

added else block to try/except; commented out print lines

parent d0ab153e
......@@ -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
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