This commit is contained in:
Norman Jäckel 2013-05-30 01:17:24 +02:00
parent c81177ea7a
commit 9e5088d49e
3 changed files with 15 additions and 1 deletions

View File

@ -43,7 +43,7 @@
</small>
</h1>
<p>
{% if item.get_related_slide == item %}
{% if not item.related_sid %}
{{ item.text|safe|linebreaks }}
{% else %}
<a href="{% model_url item.get_related_slide %}" class="btn btn-small">{% trans 'View' %} "{{ item.get_related_slide }}" ({% trans item.get_related_type %})</a>

View File

@ -15,4 +15,8 @@ class ReleatedItem(SlideMixin, models.Model):
def get_agenda_title_supplement(self):
return 'test item'
def get_absolute_url(self, *args, **kwargs):
return '/absolute-url-here/'
register_slidemodel(ReleatedItem)

View File

@ -192,6 +192,16 @@ class ViewTest(TestCase):
self.refreshItems()
self.assertEqual(self.item1.title, 'newitem1')
def test_view(self):
item = Item.objects.create(title='quai5OTeephaequ0xei0')
c = self.adminClient
response = c.get('/agenda/%s/' % item.id)
self.assertContains(response, 'quai5OTeephaequ0xei0')
self.assertTemplateUsed(response, 'agenda/view.html')
# Test it twice for former error in the template
response = c.get('/agenda/%s/' % item.id)
self.assertContains(response, 'quai5OTeephaequ0xei0')
class ConfigTest(TestCase):
def setUp(self):