From 14a5387e2db08282bc665d820b5f09b0b3c2fe6b Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Sat, 2 Oct 2021 03:44:15 +0200 Subject: [PATCH] #50 Added ExternalLink class to to ModelView. --- django_lostplaces/lostplaces/views/views.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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)