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): ...@@ -76,20 +76,23 @@ class RedirectSlug(RedirectView):
# sending the student to-- this is just about changing the url # sending the student to-- this is just about changing the url
def get_redirect_url(self, *args, **kwargs): def get_redirect_url(self, *args, **kwargs):
current_url = self.request.get_full_path() current_url = self.request.get_full_path()
# print(self.request)
# [u'', u'gmason'] # [u'', u'gmason']
slug = current_url.split('/')[1] slug = current_url.split('/')[1]
print(slug) # print(slug)
try: try:
print('trying student') # print('trying student')
student = Student.objects.get(user__username=slug) student = Student.objects.get(user__username=slug)
return reverse('detail_student', return reverse('detail_student',
kwargs={'slug': slug}) kwargs={'slug': slug})
except ObjectDoesNotExist: except ObjectDoesNotExist:
print('trying major') # print('trying major')
try: try:
major = Major.objects.get(slug=slug) major = Major.objects.get(slug=slug)
return reverse('detail_major', return reverse('detail_major',
kwargs={'slug': slug}) kwargs={'slug': slug})
except ObjectDoesNotExist: except ObjectDoesNotExist:
raise Http404 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