mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Merge pull request #161 from PetrDlouhy/fix_staticfiles
fix gen_coll_tabular.html template
This commit is contained in:
commit
c9c8d3d0d5
2 changed files with 18 additions and 3 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
{% load i18n staticfiles %}
|
{% load i18n static %}
|
||||||
<div class="inline-group">
|
<div class="inline-group">
|
||||||
<div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
|
<div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
|
||||||
{{ inline_admin_formset.formset.management_form }}
|
{{ inline_admin_formset.formset.management_form }}
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
{% if inline_admin_form.form.non_field_errors %}
|
{% if inline_admin_form.form.non_field_errors %}
|
||||||
<tr><td colspan="{{ inline_admin_form.field_count }}">{{ inline_admin_form.form.non_field_errors }}</td></tr>
|
<tr><td colspan="{{ inline_admin_form.field_count }}">{{ inline_admin_form.form.non_field_errors }}</td></tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<tr class="{% cycle row1,row2 %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}">
|
<tr class="{% cycle 'row1' 'row2' %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}">
|
||||||
<td class="original">
|
<td class="original">
|
||||||
{% if inline_admin_form.original or inline_admin_form.show_url %}<p>
|
{% if inline_admin_form.original or inline_admin_form.show_url %}<p>
|
||||||
{% if inline_admin_form.original %} {{ inline_admin_form.original.content_object }}{% endif %}
|
{% if inline_admin_form.original %} {{ inline_admin_form.original.content_object }}{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.test import Client, TestCase
|
from django.test import Client, TestCase
|
||||||
|
from django.test.utils import override_settings
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils.encoding import smart_str
|
from django.utils.encoding import smart_str
|
||||||
|
|
||||||
|
|
@ -9,9 +10,9 @@ from categories.models import Category
|
||||||
class TestCategoryAdmin(TestCase):
|
class TestCategoryAdmin(TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.client = Client()
|
self.client = Client()
|
||||||
|
self.superuser = User.objects.create_superuser("testuser", "testuser@example.com", "password")
|
||||||
|
|
||||||
def test_adding_parent_and_child(self):
|
def test_adding_parent_and_child(self):
|
||||||
User.objects.create_superuser("testuser", "testuser@example.com", "password")
|
|
||||||
self.client.login(username="testuser", password="password")
|
self.client.login(username="testuser", password="password")
|
||||||
url = reverse("admin:categories_category_add")
|
url = reverse("admin:categories_category_add")
|
||||||
data = {
|
data = {
|
||||||
|
|
@ -65,3 +66,17 @@ class TestCategoryAdmin(TestCase):
|
||||||
url = reverse("admin:categories_category_changelist")
|
url = reverse("admin:categories_category_changelist")
|
||||||
resp = self.client.get(url)
|
resp = self.client.get(url)
|
||||||
self.assertEqual(resp.status_code, 200)
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
|
||||||
|
@override_settings(RELATION_MODELS=True)
|
||||||
|
def test_addview_get(self):
|
||||||
|
self.client.force_login(self.superuser)
|
||||||
|
url = reverse("admin:categories_category_add")
|
||||||
|
resp = self.client.get(url)
|
||||||
|
self.assertEqual(resp.status_code, 200)
|
||||||
|
self.assertContains(resp, '<tr class="row1 ">')
|
||||||
|
self.assertContains(
|
||||||
|
resp,
|
||||||
|
'<input type="number" name="categoryrelation_set-0-object_id" class="vIntegerField" '
|
||||||
|
'min="0" id="id_categoryrelation_set-0-object_id">',
|
||||||
|
html=True,
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue