Compare commits
No commits in common. "a37a445986ba598a835265540ce96f81555617f5" and "86f04c08ff3f140d4aa99fb7433c4c4e4a1d62e1" have entirely different histories.
a37a445986
...
86f04c08ff
@ -8,14 +8,9 @@ LINK_TYPES = (
|
||||
('vimeo', "Vimeo"),
|
||||
('flickr', 'Flickr'),
|
||||
('googlephotos', "Google Photos"),
|
||||
('photoalbum', "Photo album"),
|
||||
('photoalbum', "Photo album")
|
||||
)
|
||||
|
||||
LINK_DOMAINS = {
|
||||
'youtu.be': 'youtube',
|
||||
'y2u.be': 'youtube',
|
||||
}
|
||||
|
||||
class ExternalLink(PlaceAsset):
|
||||
|
||||
class Meta:
|
||||
|
@ -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, ExternalLink, external_links
|
||||
from lostplaces.models import Place, ExternalLink
|
||||
from lostplaces.views.base_views import IsAuthenticatedMixin
|
||||
from lostplaces.common import redirect_referer_or
|
||||
|
||||
@ -54,18 +54,6 @@ class ExternalLinkCreateView(PlaceAssetCreateView):
|
||||
template_name = 'external_link/external_link_create.html'
|
||||
success_message = _('External link submitted')
|
||||
|
||||
def post(self, request, place_id, *args, **kwargs):
|
||||
response = super().post(request, place_id, *args, **kwargs)
|
||||
if not self.object.linktype:
|
||||
for domain, link_type in external_links.LINK_DOMAINS.items():
|
||||
if domain in self.object.url:
|
||||
self.object.linktype = link_type
|
||||
self.object.save()
|
||||
break
|
||||
else:
|
||||
self.object.linktype = None
|
||||
return response
|
||||
|
||||
class ExternalLinkDeleteView(PlaceAssetDeleteView):
|
||||
model = ExternalLink
|
||||
pk_url_kwarg = 'pk'
|
||||
|
Loading…
Reference in New Issue
Block a user