Files
ferglie/dispatcher/views.py
Fergal Moran 0c4e910b9e MVP Done
2017-05-09 23:31:55 +01:00

14 lines
339 B
Python
Executable File

# Create your views here.
from django.http.response import Http404, HttpResponseRedirect
from core import url
from shorts.models import Url
def dispatch(request, dispatch_id):
try:
u = Url.objects.get(shortened_url=dispatch_id)
return HttpResponseRedirect(u.url)
except Url.DoesNotExist:
raise Http404()