Merge lp:~michael.nelson/ubuntu-webcatalog/fix-admin-template into lp:ubuntu-webcatalog

Proposed by Michael Nelson
Status: Merged
Approved by: Łukasz Czyżykowski
Approved revision: 184
Merged at revision: 183
Proposed branch: lp:~michael.nelson/ubuntu-webcatalog/fix-admin-template
Merge into: lp:ubuntu-webcatalog
Diff against target: 53 lines (+16/-2)
3 files modified
django_project/config/main.cfg (+4/-0)
src/webcatalog/templates/admin/login.html (+2/-2)
src/webcatalog/tests/test_views.py (+10/-0)
To merge this branch: bzr merge lp:~michael.nelson/ubuntu-webcatalog/fix-admin-template
Reviewer Review Type Date Requested Status
Łukasz Czyżykowski (community) Approve
Review via email: mp+161155@code.launchpad.net

Commit message

Update custom admin/login.html so that we're not using a templatetag library no longer available in django 1.5.

Description of the change

The /admin/ url was 500ing on staging after deploy. Turns out it's because we've got an admin/login.html template that uses an admin templatetag library that is no longer available in django 1.5. It wasn't obvious in our dev environment, because this admin template wasn't found (staging/prod has the template_dirs setting, which we didn't have locally, which enables the admin template to be found in the non-admin template dir).

fab test:pg=true

To post a comment you must log in.
Revision history for this message
Łukasz Czyżykowski (lukasz-czyzykowski) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'django_project/config/main.cfg'
2--- django_project/config/main.cfg 2013-04-23 07:32:27 +0000
3+++ django_project/config/main.cfg 2013-04-26 14:31:27 +0000
4@@ -41,6 +41,10 @@
5 django.template.loaders.app_directories.Loader
6 django.template.loaders.eggs.Loader
7
8+# This enables the admin app to find webcatalog/templates/admin like the
9+# staging/prod configs. Comment out to login normally on the dev server.
10+template_dirs = src/webcatalog/templates
11+
12 secret_key = eepu9Av5ixage9ahhodovahfaiFoorodahf6keip3eichaeW9f
13 template_debug = %(debug)s
14 time_zone = Europe/London
15
16=== modified file 'src/webcatalog/templates/admin/login.html'
17--- src/webcatalog/templates/admin/login.html 2011-08-10 18:58:04 +0000
18+++ src/webcatalog/templates/admin/login.html 2013-04-26 14:31:27 +0000
19@@ -1,7 +1,7 @@
20 {% extends "admin/base_site.html" %}
21-{% load i18n %}
22+{% load i18n admin_static %}
23
24-{% block extrastyle %}<link rel="stylesheet" type="text/css" href="{% load adminmedia %}{% admin_media_prefix %}css/login.css" />{% endblock %}
25+{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/login.css" %}" />{% endblock %}
26
27 {% block bodyclass %}login{% endblock %}
28
29
30=== modified file 'src/webcatalog/tests/test_views.py'
31--- src/webcatalog/tests/test_views.py 2013-04-09 13:53:18 +0000
32+++ src/webcatalog/tests/test_views.py 2013-04-26 14:31:27 +0000
33@@ -43,6 +43,7 @@
34
35 __metaclass__ = type
36 __all__ = [
37+ 'AdminLoginTestCase',
38 'ApplicationDetailNoSeriesTestCase',
39 'ApplicationDetailTestCase',
40 'ApplicationListTestCase',
41@@ -1454,3 +1455,12 @@
42 expected = {"status": "PENDING", "traceback": None, "id": "cafe"}
43
44 self.assertEqual(expected, data)
45+
46+
47+class AdminLoginTestCase(TestCase):
48+
49+ def test_unauthed_admin_renders(self):
50+ response = self.client.get('/admin/')
51+
52+ self.assertEqual(response.status_code, 200)
53+ self.assertContains(response, 'action="/openid/login/"')

Subscribers

People subscribed via source and target branches