Merge pull request #1171 from ostcar/remove_edit

removed edit and view in get_absolute_view
This commit is contained in:
Norman Jäckel 2014-01-11 08:56:42 -08:00
commit 26ec43bcea
8 changed files with 15 additions and 17 deletions

View File

@ -124,9 +124,9 @@ class Item(SlideMixin, MPTTModel):
The link can be detail, update or delete. 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)]) 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)]) url = reverse('item_edit', args=[str(self.id)])
elif link == 'delete': elif link == 'delete':
url = reverse('item_delete', args=[str(self.id)]) url = reverse('item_delete', args=[str(self.id)])
@ -345,7 +345,7 @@ class Speaker(models.Model):
return unicode(self.person) return unicode(self.person)
def get_absolute_url(self, link='detail'): def get_absolute_url(self, link='detail'):
if link == 'detail' or link == 'view': if link == 'detail':
return self.person.get_absolute_url('detail') return self.person.get_absolute_url('detail')
if link == 'delete': if link == 'delete':
return reverse('agenda_speaker_delete', return reverse('agenda_speaker_delete',

View File

@ -72,7 +72,7 @@ class Mediafile(SlideMixin, models.Model):
Returns the URL to a mediafile. The link can be 'projector', Returns the URL to a mediafile. The link can be 'projector',
'update' or 'delete'. '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)}) return reverse('mediafile_update', kwargs={'pk': str(self.id)})
if link == 'delete': if link == 'delete':
return reverse('mediafile_delete', kwargs={'pk': str(self.id)}) return reverse('mediafile_delete', kwargs={'pk': str(self.id)})

View File

@ -171,12 +171,11 @@ class Motion(SlideMixin, models.Model):
""" """
Return an URL for this version. Return an URL for this version.
The keyword argument 'link' can be 'detail', 'view', 'edit', The keyword argument 'link' can be 'detail', 'update' or 'delete'.
'update' or 'delete'.
""" """
if link == 'view' or link == 'detail': if link == 'detail':
return reverse('motion_detail', args=[str(self.id)]) 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)]) return reverse('motion_update', args=[str(self.id)])
if link == 'delete': if link == 'delete':
return reverse('motion_delete', args=[str(self.id)]) return reverse('motion_delete', args=[str(self.id)])
@ -617,7 +616,7 @@ class Category(models.Model):
return self.name return self.name
def get_absolute_url(self, link='update'): 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)]) return reverse('motion_category_update', args=[str(self.id)])
if link == 'delete': if link == 'delete':
return reverse('motion_category_delete', args=[str(self.id)]) return reverse('motion_category_delete', args=[str(self.id)])

View File

@ -64,9 +64,9 @@ class User(SlideMixin, PersonMixin, Person, DjangoUser):
""" """
Return the URL to the user. Return the URL to the user.
""" """
if link == 'detail' or link == 'view': if link == 'detail':
return reverse('user_view', args=[str(self.id)]) 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)]) return reverse('user_edit', args=[str(self.id)])
if link == 'delete': if link == 'delete':
return reverse('user_delete', args=[str(self.id)]) 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. 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)]) 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)]) return reverse('user_group_edit', args=[str(self.pk)])
if link == 'delete': if link == 'delete':
return reverse('user_group_delete', args=[str(self.pk)]) return reverse('user_group_delete', args=[str(self.pk)])

View File

@ -119,7 +119,7 @@ class ProjectorSlide(SlideMixin, models.Model):
weight = models.IntegerField(default=0, verbose_name=ugettext_lazy("Weight")) weight = models.IntegerField(default=0, verbose_name=ugettext_lazy("Weight"))
def get_absolute_url(self, link='update'): def get_absolute_url(self, link='update'):
if link == 'edit' or link == 'update': if link == 'update':
return reverse('customslide_edit', args=[str(self.pk)]) return reverse('customslide_edit', args=[str(self.pk)])
if link == 'delete': if link == 'delete':
return reverse('customslide_delete', args=[str(self.pk)]) return reverse('customslide_delete', args=[str(self.pk)])

View File

@ -67,7 +67,7 @@ class ItemTest(TestCase):
def test_absolute_url(self): def test_absolute_url(self):
self.assertEqual(self.item1.get_absolute_url(), '/agenda/1/') 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/') self.assertEqual(self.item1.get_absolute_url('delete'), '/agenda/1/del/')
def test_related_item(self): def test_related_item(self):

View File

@ -46,7 +46,6 @@ class MediafileTest(TestCase):
def test_absolute_url(self): def test_absolute_url(self):
self.assertEqual(self.object.get_absolute_url(), '/mediafile/1/edit/') 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('update'), '/mediafile/1/edit/')
self.assertEqual(self.object.get_absolute_url(link='delete'), '/mediafile/1/del/') self.assertEqual(self.object.get_absolute_url(link='delete'), '/mediafile/1/del/')

View File

@ -60,7 +60,7 @@ class ModelTest(TestCase):
motion_id = self.motion.id motion_id = self.motion.id
self.assertEqual(self.motion.get_absolute_url('detail'), '/motion/%d/' % 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) self.assertEqual(self.motion.get_absolute_url('delete'), '/motion/%d/del/' % motion_id)
def test_supporter(self): def test_supporter(self):