Merge pull request #1171 from ostcar/remove_edit
removed edit and view in get_absolute_view
This commit is contained in:
commit
26ec43bcea
@ -124,9 +124,9 @@ class Item(SlideMixin, MPTTModel):
|
||||
|
||||
The link can be detail, update or delete.
|
||||
"""
|
||||
if link == 'detail' or link == 'view':
|
||||
if link == 'detail':
|
||||
url = reverse('item_view', args=[str(self.id)])
|
||||
elif link == 'update' or link == 'edit':
|
||||
elif link == 'update':
|
||||
url = reverse('item_edit', args=[str(self.id)])
|
||||
elif link == 'delete':
|
||||
url = reverse('item_delete', args=[str(self.id)])
|
||||
@ -345,7 +345,7 @@ class Speaker(models.Model):
|
||||
return unicode(self.person)
|
||||
|
||||
def get_absolute_url(self, link='detail'):
|
||||
if link == 'detail' or link == 'view':
|
||||
if link == 'detail':
|
||||
return self.person.get_absolute_url('detail')
|
||||
if link == 'delete':
|
||||
return reverse('agenda_speaker_delete',
|
||||
|
@ -72,7 +72,7 @@ class Mediafile(SlideMixin, models.Model):
|
||||
Returns the URL to a mediafile. The link can be 'projector',
|
||||
'update' or 'delete'.
|
||||
"""
|
||||
if link == 'update' or link == 'edit': # 'edit' ist only used until utils/views.py is fixed
|
||||
if link == 'update':
|
||||
return reverse('mediafile_update', kwargs={'pk': str(self.id)})
|
||||
if link == 'delete':
|
||||
return reverse('mediafile_delete', kwargs={'pk': str(self.id)})
|
||||
|
@ -171,12 +171,11 @@ class Motion(SlideMixin, models.Model):
|
||||
"""
|
||||
Return an URL for this version.
|
||||
|
||||
The keyword argument 'link' can be 'detail', 'view', 'edit',
|
||||
'update' or 'delete'.
|
||||
The keyword argument 'link' can be 'detail', 'update' or 'delete'.
|
||||
"""
|
||||
if link == 'view' or link == 'detail':
|
||||
if link == 'detail':
|
||||
return reverse('motion_detail', args=[str(self.id)])
|
||||
if link == 'update' or link == 'edit':
|
||||
if link == 'update':
|
||||
return reverse('motion_update', args=[str(self.id)])
|
||||
if link == 'delete':
|
||||
return reverse('motion_delete', args=[str(self.id)])
|
||||
@ -617,7 +616,7 @@ class Category(models.Model):
|
||||
return self.name
|
||||
|
||||
def get_absolute_url(self, link='update'):
|
||||
if link == 'update' or link == 'edit':
|
||||
if link == 'update':
|
||||
return reverse('motion_category_update', args=[str(self.id)])
|
||||
if link == 'delete':
|
||||
return reverse('motion_category_delete', args=[str(self.id)])
|
||||
|
@ -64,9 +64,9 @@ class User(SlideMixin, PersonMixin, Person, DjangoUser):
|
||||
"""
|
||||
Return the URL to the user.
|
||||
"""
|
||||
if link == 'detail' or link == 'view':
|
||||
if link == 'detail':
|
||||
return reverse('user_view', args=[str(self.id)])
|
||||
if link == 'edit' or link == 'update':
|
||||
if link == 'update':
|
||||
return reverse('user_edit', args=[str(self.id)])
|
||||
if link == 'delete':
|
||||
return reverse('user_delete', args=[str(self.id)])
|
||||
@ -129,9 +129,9 @@ class Group(SlideMixin, PersonMixin, Person, DjangoGroup):
|
||||
"""
|
||||
Return the URL to the user group.
|
||||
"""
|
||||
if link == 'detail' or link == 'view':
|
||||
if link == 'detail':
|
||||
return reverse('user_group_view', args=[str(self.pk)])
|
||||
if link == 'update' or link == 'edit':
|
||||
if link == 'update':
|
||||
return reverse('user_group_edit', args=[str(self.pk)])
|
||||
if link == 'delete':
|
||||
return reverse('user_group_delete', args=[str(self.pk)])
|
||||
|
@ -119,7 +119,7 @@ class ProjectorSlide(SlideMixin, models.Model):
|
||||
weight = models.IntegerField(default=0, verbose_name=ugettext_lazy("Weight"))
|
||||
|
||||
def get_absolute_url(self, link='update'):
|
||||
if link == 'edit' or link == 'update':
|
||||
if link == 'update':
|
||||
return reverse('customslide_edit', args=[str(self.pk)])
|
||||
if link == 'delete':
|
||||
return reverse('customslide_delete', args=[str(self.pk)])
|
||||
|
@ -67,7 +67,7 @@ class ItemTest(TestCase):
|
||||
|
||||
def test_absolute_url(self):
|
||||
self.assertEqual(self.item1.get_absolute_url(), '/agenda/1/')
|
||||
self.assertEqual(self.item1.get_absolute_url('edit'), '/agenda/1/edit/')
|
||||
self.assertEqual(self.item1.get_absolute_url('update'), '/agenda/1/edit/')
|
||||
self.assertEqual(self.item1.get_absolute_url('delete'), '/agenda/1/del/')
|
||||
|
||||
def test_related_item(self):
|
||||
|
@ -46,7 +46,6 @@ class MediafileTest(TestCase):
|
||||
|
||||
def test_absolute_url(self):
|
||||
self.assertEqual(self.object.get_absolute_url(), '/mediafile/1/edit/')
|
||||
self.assertEqual(self.object.get_absolute_url('edit'), '/mediafile/1/edit/')
|
||||
self.assertEqual(self.object.get_absolute_url('update'), '/mediafile/1/edit/')
|
||||
self.assertEqual(self.object.get_absolute_url(link='delete'), '/mediafile/1/del/')
|
||||
|
||||
|
@ -60,7 +60,7 @@ class ModelTest(TestCase):
|
||||
motion_id = self.motion.id
|
||||
|
||||
self.assertEqual(self.motion.get_absolute_url('detail'), '/motion/%d/' % motion_id)
|
||||
self.assertEqual(self.motion.get_absolute_url('edit'), '/motion/%d/edit/' % motion_id)
|
||||
self.assertEqual(self.motion.get_absolute_url('update'), '/motion/%d/edit/' % motion_id)
|
||||
self.assertEqual(self.motion.get_absolute_url('delete'), '/motion/%d/del/' % motion_id)
|
||||
|
||||
def test_supporter(self):
|
||||
|
Loading…
Reference in New Issue
Block a user