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
go
Commits
5e2c452a
Commit
5e2c452a
authored
Dec 20, 2013
by
Jean Michel Rouly
Browse files
Added success view for after registration.
parent
2f757016
Changes
3
Show whitespace changes
Inline
Side-by-side
go/go/views.py
View file @
5e2c452a
...
...
@@ -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
):
...
...
go/settings/urls.py
View file @
5e2c452a
...
...
@@ -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'
),
...
...
go/templates/success.html
0 → 100644
View file @
5e2c452a
{% 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 %}
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