2020-09-22 21:56:51 +02:00
|
|
|
from django.db import models
|
2020-10-11 02:23:51 +02:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2020-09-22 21:56:51 +02:00
|
|
|
|
|
|
|
from lostplaces.models.place import PlaceAsset
|
|
|
|
|
2021-10-02 04:40:37 +02:00
|
|
|
LINK_TYPES = (
|
|
|
|
('youtube', 'YouTube'),
|
|
|
|
('vimeo', "Vimeo"),
|
|
|
|
('flickr', 'Flickr'),
|
|
|
|
('googlephotos', "Google Photos"),
|
2021-10-02 06:00:25 +02:00
|
|
|
('photoalbum', "Photo album"),
|
2021-10-02 04:40:37 +02:00
|
|
|
)
|
|
|
|
|
2021-10-02 06:00:25 +02:00
|
|
|
LINK_DOMAINS = {
|
|
|
|
'youtu.be': 'youtube',
|
|
|
|
'y2u.be': 'youtube',
|
|
|
|
}
|
|
|
|
|
2020-09-22 21:56:51 +02:00
|
|
|
class ExternalLink(PlaceAsset):
|
2021-10-02 02:40:48 +02:00
|
|
|
|
2020-09-22 21:56:51 +02:00
|
|
|
class Meta:
|
2021-10-02 02:40:48 +02:00
|
|
|
abstract = False
|
2020-09-22 21:56:51 +02:00
|
|
|
|
2020-10-11 02:23:51 +02:00
|
|
|
url = models.URLField(
|
|
|
|
max_length=200,
|
|
|
|
verbose_name=_('URL')
|
|
|
|
)
|
|
|
|
label = models.CharField(
|
|
|
|
max_length=100,
|
|
|
|
verbose_name=_('link text')
|
|
|
|
)
|
2021-10-02 02:40:48 +02:00
|
|
|
linktype = models.CharField(
|
2021-10-02 04:40:37 +02:00
|
|
|
choices=LINK_TYPES,
|
2021-10-02 02:40:48 +02:00
|
|
|
max_length=20,
|
|
|
|
verbose_name=_('link type'),
|
|
|
|
blank=True,
|
|
|
|
null=True
|
|
|
|
)
|