From 4f2b94616c8946ab7f42679b913cc63224c71114 Mon Sep 17 00:00:00 2001 From: Krzysztof Klimonda Date: Mon, 25 Feb 2013 01:22:38 +0100 Subject: [PATCH] Remove pinry.pins.views.delete_pin REST API should be used to delete pins anyway, so remove the old code that is not being used. --- pinry/pins/urls.py | 1 - pinry/pins/views.py | 15 --------------- 2 files changed, 16 deletions(-) diff --git a/pinry/pins/urls.py b/pinry/pins/urls.py index 52d71c5..0e88df4 100644 --- a/pinry/pins/urls.py +++ b/pinry/pins/urls.py @@ -8,5 +8,4 @@ urlpatterns = patterns('pinry.pins.views', url(r'^$', RecentPins.as_view(), name='recent-pins'), url(r'^tag/.+/$', RecentPins.as_view(), name='tag'), url(r'^new-pin/$', NewPin.as_view(), name='new-pin'), - url(r'^delete-pin/(?P\d+)/$', 'delete_pin', name='delete-pin'), ) diff --git a/pinry/pins/views.py b/pinry/pins/views.py index 9c8bcb1..9ff6196 100644 --- a/pinry/pins/views.py +++ b/pinry/pins/views.py @@ -29,18 +29,3 @@ class NewPin(CreateView): def form_invalid(self, form): messages.error(self.request, 'Pin did not pass validation!') return super(NewPin, self).form_invalid(form) - - -def delete_pin(request, pin_id): - try: - pin = Pin.objects.get(id=pin_id) - if pin.submitter == request.user: - pin.delete() - messages.success(request, 'Pin successfully deleted.') - else: - messages.error(request, 'You are not the submitter and can not ' - 'delete this pin.') - except Pin.DoesNotExist: - messages.error(request, 'Pin with the given id does not exist.') - - return HttpResponseRedirect(reverse('pins:recent-pins'))