#50 Added ExternalLink class to to ModelView.

This commit is contained in:
Marcus Scholz 2021-10-02 03:44:15 +02:00
parent dd4b4f936b
commit 14a5387e2d

View File

@ -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)