Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion shortener/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from django.conf.urls.defaults import patterns, url
try:
from django.conf.urls import patterns, url
except:
# Django <=1.5
from django.conf.urls.defaults import patterns, url


urlpatterns = patterns('shortener.views',
Expand Down
4 changes: 2 additions & 2 deletions templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</head>

<body>
<h1><a href="{% url index %}">{{ request.META.HTTP_HOST }}</a></h1>
<h1><a href="{% url 'index' %}">{{ request.META.HTTP_HOST }}</a></h1>
<hr/>
{% block content %}{% endblock %}

Expand All @@ -15,7 +15,7 @@ <h1><a href="{% url index %}">{{ request.META.HTTP_HOST }}</a></h1>
{% block bookmarklet %}
<br/>
Bookmarklet (drag this to your bookmarks bar):<br/>
<a href="javascript:(function(){var a=window,b=document,c=encodeURIComponent;d=a.open(&#39;//{{ request.META.HTTP_HOST }}/submit/?u=&#39;+c(b.location));})();">Shorten with {{ request.META.HTTP_HOST }}</a>
<a href="javascript:(function(){var a=window,b=document,c=encodeURIComponent;d=a.open(&#39;//{{ request.META.HTTP_HOST }}{% url 'index' %}submit/?u=&#39;+c(b.location));})();">Shorten with {{ request.META.HTTP_HOST }}</a>
{% endblock %}

{% block extra_body %}{% endblock %}
Expand Down
2 changes: 1 addition & 1 deletion templates/shortener/form.inc.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% if link_form %}
<form name="url_form" action="{% url submit %}" method="post">
<form name="url_form" action="{% url 'submit' %}" method="post">
{% csrf_token %}
{{ link_form.as_p }}
<input type="submit" value="Shorten" />
Expand Down
4 changes: 2 additions & 2 deletions templates/shortener/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ <h2>Recent Links</h2>
<ul>
{% for link in recent_links %}
<li><a href="{% short_url link %}">{{ link.url }}</a> (Count: {{ link.usage_count }})
(<a href="{% url info link.to_base62 %}">Info</a>)</li>
(<a href="{% url 'info' link.to_base62 %}">Info</a>)</li>
{% endfor %}
</ul>

<h2>Most Popular Links</h2>
<ul>
{% for link in most_popular_links %}
<li><a href="{% short_url link %}">{{ link.url }}</a> (Count: {{ link.usage_count }})
(<a href="{% url info link.to_base62 %}">Info</a>)</li>
(<a href="{% url 'info' link.to_base62 %}">Info</a>)</li>
{% endfor %}
</ul>
{% endblock content %}