diff --git a/django_lostplaces/lostplaces/views/views.py b/django_lostplaces/lostplaces/views/views.py index a72fd8f..af14d6a 100644 --- a/django_lostplaces/lostplaces/views/views.py +++ b/django_lostplaces/lostplaces/views/views.py @@ -12,7 +12,7 @@ from django.http import HttpResponseForbidden from django.utils.translation import ugettext_lazy as _ from lostplaces.forms import SignupVoucherForm, TagSubmitForm -from lostplaces.models import Place, PhotoAlbum +from lostplaces.models import Place, PhotoAlbum, ExternalLink from lostplaces.views.base_views import IsAuthenticatedMixin from lostplaces.common import redirect_referer_or @@ -60,6 +60,18 @@ class PhotoAlbumDeleteView(PlaceAssetDeleteView): success_message = _('Photo album link deleted') permission_denied_messsage = _('You are not allowed to edit this photo album link') +class ExternalLinkCreateView(PlaceAssetCreateView): + model = ExternalLink + fields = ['url', 'label', 'linktype'] + template_name = 'external_link/external_link_create.html' + success_message = _('External link submitted') + +class ExternalLinkDeleteView(PlaceAssetDeleteView): + model = ExternalLink + pk_url_kwarg = 'pk' + success_message = _('External link deleted') + permission_denied_messsage = _('You are not allowed to edit this external link') + class PlaceTagSubmitView(IsAuthenticatedMixin, View): def post(self, request, tagged_id, *args, **kwargs): place = get_object_or_404(Place, pk=tagged_id)