Author: kmtracey
Date: 2008-10-24 14:18:10 -0500 (Fri, 24 Oct 2008)
New Revision: 9277
Modified:
django/branches/releases/1.0.X/
django/branches/releases/1.0.X/django/contrib/admin/templates/admin/change_form.html
django/branches/releases/1.0.X/tests/regressiontests/admin_views/tests.py
Log:
[1.0.X] Fixed #7179 -- Changed breadcrumbs on the add page so that a link to
the change view is not included when the user doesn't have permission for that
view. Also added tests to ensure the link is not there when it shouldn't be,
and there when it should be. Thanks for the report & patch alen__ribic.
Property changes on: django/branches/releases/1.0.X
___________________________________________________________________
Name: svnmerge-integrated
-
/django/trunk:1-9097,9099-9102,9104-9109,9111,9113-9144,9146-9151,9153-9156,9158-9159,9161-9187,9189-9247,9249-9262,9264-9274
+
/django/trunk:1-9097,9099-9102,9104-9109,9111,9113-9144,9146-9151,9153-9156,9158-9159,9161-9187,9189-9247,9249-9262,9264-9276
Modified:
django/branches/releases/1.0.X/django/contrib/admin/templates/admin/change_form.html
===================================================================
---
django/branches/releases/1.0.X/django/contrib/admin/templates/admin/change_form.html
2008-10-24 19:14:24 UTC (rev 9276)
+++
django/branches/releases/1.0.X/django/contrib/admin/templates/admin/change_form.html
2008-10-24 19:18:10 UTC (rev 9277)
@@ -16,7 +16,7 @@
<div class="breadcrumbs">
<a href="../../../">{% trans "Home" %}</a> ›
<a href="../../">{{ app_label|capfirst|escape }}</a> ›
- <a href="../">{{ opts.verbose_name_plural|capfirst }}</a> ›
+ {% if has_change_permission %}<a href="../">{{
opts.verbose_name_plural|capfirst }}</a>{% else %}{{
opts.verbose_name_plural|capfirst }}{% endif %} ›
{% if add %}{% trans "Add" %} {{ opts.verbose_name }}{% else %}{{
original|truncatewords:"18" }}{% endif %}
</div>
{% endif %}{% endblock %}
Modified:
django/branches/releases/1.0.X/tests/regressiontests/admin_views/tests.py
===================================================================
--- django/branches/releases/1.0.X/tests/regressiontests/admin_views/tests.py
2008-10-24 19:14:24 UTC (rev 9276)
+++ django/branches/releases/1.0.X/tests/regressiontests/admin_views/tests.py
2008-10-24 19:18:10 UTC (rev 9277)
@@ -327,6 +327,11 @@
# Add user may login and POST to add view, then redirect to admin root
self.client.get('/test_admin/admin/')
self.client.post('/test_admin/admin/', self.adduser_login)
+ addpage = self.client.get('/test_admin/admin/admin_views/article/add/')
+ self.failUnlessEqual(addpage.status_code, 200)
+ change_list_link = '<a href="../">Articles</a> ›'
+ self.failIf(change_list_link in addpage.content,
+ 'User restricted to add permission is given link to change
list view in breadcrumbs.')
post = self.client.post('/test_admin/admin/admin_views/article/add/',
add_dict)
self.assertRedirects(post, '/test_admin/admin/')
self.failUnlessEqual(Article.objects.all().count(), 4)
@@ -335,6 +340,10 @@
# Super can add too, but is redirected to the change list view
self.client.get('/test_admin/admin/')
self.client.post('/test_admin/admin/', self.super_login)
+ addpage = self.client.get('/test_admin/admin/admin_views/article/add/')
+ self.failUnlessEqual(addpage.status_code, 200)
+ self.failIf(change_list_link not in addpage.content,
+ 'Unrestricted user is not given link to change list view
in breadcrumbs.')
post = self.client.post('/test_admin/admin/admin_views/article/add/',
add_dict)
self.assertRedirects(post, '/test_admin/admin/admin_views/article/')
self.failUnlessEqual(Article.objects.all().count(), 5)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---