Add js-reverse as a dependency, also integrate it

This commit is contained in:
Gergely Polonkai 2015-01-05 16:12:33 +01:00 committed by Gergely Polonkai
parent 6a20ba1935
commit 13c09bb856
5 changed files with 17 additions and 2 deletions

10
api/tests.py Normal file
View File

@ -0,0 +1,10 @@
from django.test import TestCase, Client
from django.core.urlresolvers import reverse
class ReverseTest(TestCase):
def setUp(self):
self.client = Client()
def test_reverse_js(self):
response = self.client.get(reverse('api:js_reverse'))
self.assertEqual(response.status_code, 200)

View File

@ -1,7 +1,8 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page
from . import views from django_js_reverse.views import urls_js
urlpatterns = patterns( urlpatterns = patterns(
'', '',
url(r'^reverse.js$', cache_page(3600)(urls_js), name = 'js_reverse'),
) )

View File

@ -2,6 +2,8 @@
<html> <html>
<head> <head>
<title>Rubber Duck Booking Tool</title> <title>Rubber Duck Booking Tool</title>
<script src="{% url 'api:js_reverse' %}" type="text/javascript"></script>
</head> </head>
<body> <body>
<h1>Rubber Duck Booking Tool</h1> <h1>Rubber Duck Booking Tool</h1>

View File

@ -36,6 +36,7 @@ INSTALLED_APPS = (
'django.contrib.sessions', 'django.contrib.sessions',
'django.contrib.messages', 'django.contrib.messages',
'django.contrib.staticfiles', 'django.contrib.staticfiles',
'django_js_reverse',
'accounts', 'accounts',
'booking', 'booking',
) )

View File

@ -1,3 +1,4 @@
Django>=1.7,<1.8 Django>=1.7,<1.8
WebTest==2.0.17 WebTest==2.0.17
django-webtest==1.7.7 django-webtest==1.7.7
django-js-reverse==0.3.3