39 lines
799 B
Python
39 lines
799 B
Python
from django.db import models
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from lostplaces.models.place import PlaceAsset
|
|
|
|
LINK_TYPES = (
|
|
('youtube', 'YouTube'),
|
|
('vimeo', "Vimeo"),
|
|
('flickr', 'Flickr'),
|
|
('googlephotos', "Google Photos"),
|
|
('photoalbum', "Photo album"),
|
|
)
|
|
|
|
LINK_DOMAINS = {
|
|
'youtu.be': 'youtube',
|
|
'y2u.be': 'youtube',
|
|
}
|
|
|
|
class ExternalLink(PlaceAsset):
|
|
|
|
class Meta:
|
|
abstract = False
|
|
|
|
url = models.URLField(
|
|
max_length=200,
|
|
verbose_name=_('URL')
|
|
)
|
|
label = models.CharField(
|
|
max_length=100,
|
|
verbose_name=_('link text')
|
|
)
|
|
linktype = models.CharField(
|
|
choices=LINK_TYPES,
|
|
max_length=20,
|
|
verbose_name=_('link type'),
|
|
blank=True,
|
|
null=True
|
|
)
|