Ticket #17050: fix_index_div_id.diff

File fix_index_div_id.diff, 4.3 KB (added by H0ff1, 3 years ago)
  • django/contrib/admin/templates/admin/index.html

    diff --git a/django/contrib/admin/templates/admin/index.html b/django/contrib/admin/templates/admin/index.html
    index a8ced39..b4b6ef7 100644
    a b  
    1414
    1515{% if app_list %}
    1616    {% for app in app_list %}
    17         <div class="module">
     17        <div class="module" id="app-{{ app.name }}-module">
    1818        <table summary="{% blocktrans with name=app.name %}Models available in the {{ name }} application.{% endblocktrans %}">
    1919        <caption><a href="{{ app.app_url }}" class="section">{% blocktrans with name=app.name %}{{ name }}{% endblocktrans %}</a></caption>
    2020        {% for model in app.models %}
  • new file tests/regressiontests/admin_individual_ids/admin.py

    diff --git a/tests/regressiontests/admin_individual_ids/__init__.py b/tests/regressiontests/admin_individual_ids/__init__.py
    new file mode 100644
    index 0000000..e69de29
    diff --git a/tests/regressiontests/admin_individual_ids/admin.py b/tests/regressiontests/admin_individual_ids/admin.py
    new file mode 100644
    index 0000000..330361c
    - +  
     1from django.contrib import admin
     2
     3from models import *
     4
     5site = admin.AdminSite(name="admin")
     6
     7site.register(Poll)
  • new file tests/regressiontests/admin_individual_ids/fixtures/admin-views-users.xml

    diff --git a/tests/regressiontests/admin_individual_ids/fixtures/admin-views-users.xml b/tests/regressiontests/admin_individual_ids/fixtures/admin-views-users.xml
    new file mode 100644
    index 0000000..aba8f4a
    - +  
     1<?xml version="1.0" encoding="utf-8"?>
     2<django-objects version="1.0">
     3    <object pk="100" model="auth.user">
     4        <field type="CharField" name="username">super</field>
     5        <field type="CharField" name="first_name">Super</field>
     6        <field type="CharField" name="last_name">User</field>
     7        <field type="CharField" name="email">super@example.com</field>
     8        <field type="CharField" name="password">sha1$995a3$6011485ea3834267d719b4c801409b8b1ddd0158</field>
     9        <field type="BooleanField" name="is_staff">True</field>
     10        <field type="BooleanField" name="is_active">True</field>
     11        <field type="BooleanField" name="is_superuser">True</field>
     12        <field type="DateTimeField" name="last_login">2007-05-30 13:20:10</field>
     13        <field type="DateTimeField" name="date_joined">2007-05-30 13:20:10</field>
     14        <field to="auth.group" name="groups" rel="ManyToManyRel"></field>
     15        <field to="auth.permission" name="user_permissions" rel="ManyToManyRel"></field>
     16    </object>
     17</django-objects>
  • new file tests/regressiontests/admin_individual_ids/models.py

    diff --git a/tests/regressiontests/admin_individual_ids/models.py b/tests/regressiontests/admin_individual_ids/models.py
    new file mode 100644
    index 0000000..bb8e8b4
    - +  
     1"""
     2Testing of individual ids for models in Admin.
     3
     4"""
     5from django.db import models
     6
     7class Poll(models.Model):
     8    name = models.CharField(max_length=40)
  • new file tests/regressiontests/admin_individual_ids/tests.py

    diff --git a/tests/regressiontests/admin_individual_ids/tests.py b/tests/regressiontests/admin_individual_ids/tests.py
    new file mode 100644
    index 0000000..c7959de
    - +  
     1from __future__ import absolute_import
     2
     3from django.test import TestCase
     4
     5
     6class TestIndividualIds(TestCase):
     7    urls = "regressiontests.admin_individual_ids.urls"
     8    fixtures = ['admin-views-users.xml']
     9
     10    def setUp(self):
     11        self.change_url = '/admin/'
     12
     13        result = self.client.login(username='super', password='secret')
     14        self.assertEqual(result, True)
     15
     16    def tearDown(self):
     17        self.client.logout()
     18
     19    def test_are_ids_ok(self):
     20        """Test if the ids are there and if they are right."""
     21        response = self.client.get(self.change_url)
     22        self.assertContains(response, '<div class="module" id="app-Admin_Individual_Ids-module">')
     23
  • new file tests/regressiontests/admin_individual_ids/urls.py

    diff --git a/tests/regressiontests/admin_individual_ids/urls.py b/tests/regressiontests/admin_individual_ids/urls.py
    new file mode 100644
    index 0000000..cf18ef9
    - +  
     1from __future__ import absolute_import
     2
     3from django.conf.urls import patterns, include
     4
     5from . import admin
     6
     7
     8urlpatterns = patterns('',
     9    (r'^admin/', include(admin.site.urls)),
     10)
Back to Top