Merge pull request #686 from normanjaeckel/Fix_Agenda

Fixed #683
This commit is contained in:
Oskar Hahn 2013-05-31 04:52:28 -07:00
commit 061ed31ffb
3 changed files with 15 additions and 1 deletions

View File

@ -43,7 +43,7 @@
</small> </small>
</h1> </h1>
<p> <p>
{% if item.get_related_slide == item %} {% if not item.related_sid %}
{{ item.text|safe|linebreaks }} {{ item.text|safe|linebreaks }}
{% else %} {% 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> <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): def get_agenda_title_supplement(self):
return 'test item' return 'test item'
def get_absolute_url(self, *args, **kwargs):
return '/absolute-url-here/'
register_slidemodel(ReleatedItem) register_slidemodel(ReleatedItem)

View File

@ -192,6 +192,16 @@ class ViewTest(TestCase):
self.refreshItems() self.refreshItems()
self.assertEqual(self.item1.title, 'newitem1') 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): class ConfigTest(TestCase):
def setUp(self): def setUp(self):