Commit 5e2c452a authored by Jean Michel Rouly's avatar Jean Michel Rouly

Added success view for after registration.

parent 2f757016
......@@ -35,13 +35,28 @@ def index(request):
url.full_clean()
url.save()
return redirect('success', url.target, url.short)
return redirect('success')
return render(request, 'index.html', {
'form': url_form,
},
)
# Sucessful url registration page.
@login_required
def success(request):
url = None
try:
url = URL.objects.filter(owner=request.user).latest('date_created')
except URL.DoesNotExist:
pass
return render(request, 'success.html', {
'url': url,
},
)
# My-Links page.
@login_required
def my_links(request, permission = True):
......
......@@ -8,6 +8,9 @@ urlpatterns = patterns('go.views',
# / - Homepage url.
url(r'^$', 'index', name = 'index'),
# / - Successful url registration page.
url(r'^success$', 'success', name = 'success'),
# /about - About page.
url(r'^about/?$', 'about', name = 'about'),
......
{% extends 'base.html' %}
{% block title %}
Go - Success
{% endblock %}
{% block content %}
{# If it exists, display the most recently created URL. #}
{% if url %}
<h3>~Shorten URL~</h3>
<p><em>Original URL</em>: <a href="{{ url.target }}">{{ url.target }}</a></p>
<p><em>Shortened URL</em>: <a href="{{ url.short }}">{{ url.short }}</a></p>
{% else %}
<p>Nothing here.</p>
{% endif %}
{% endblock %}
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