#65 KML Import
This commit is contained in:
@@ -27,9 +27,39 @@ PLACE_MODES = (
|
||||
('live', 'live'),
|
||||
('draft', 'draft'),
|
||||
('review', 'review'),
|
||||
('archive', 'archive')
|
||||
('archive', 'archive'),
|
||||
('imported', 'imported')
|
||||
)
|
||||
|
||||
PLACE_IMPORT_TYPES = (
|
||||
('kml', 'KML-File import'),
|
||||
)
|
||||
|
||||
class PlaceImport(models.Model):
|
||||
imported_when = models.DateTimeField(
|
||||
auto_now_add=True,
|
||||
verbose_name=_('When the imported has taken place')
|
||||
)
|
||||
|
||||
description = models.TextField(
|
||||
default=None,
|
||||
null=True,
|
||||
verbose_name=_('Description of the import')
|
||||
)
|
||||
|
||||
explorer = models.ForeignKey(
|
||||
'Explorer',
|
||||
null=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='place_imports'
|
||||
)
|
||||
|
||||
import_type = models.TextField(
|
||||
default='kml',
|
||||
choices=PLACE_IMPORT_TYPES,
|
||||
verbose_name=_('What kind of import this is')
|
||||
)
|
||||
|
||||
class Place(Submittable, Taggable, Mapable):
|
||||
"""
|
||||
Place defines a lost place (location, name, description etc.).
|
||||
@@ -63,6 +93,16 @@ class Place(Submittable, Taggable, Mapable):
|
||||
verbose_name=_('Mode of Place Editing')
|
||||
)
|
||||
|
||||
place_import = models.ForeignKey(
|
||||
PlaceImport,
|
||||
null=True,
|
||||
on_delete=models.SET_NULL,
|
||||
related_name='place_list'
|
||||
)
|
||||
|
||||
def is_imported(self):
|
||||
return self.place_import != None
|
||||
|
||||
def get_hero_image(self):
|
||||
if self.hero:
|
||||
return self.hero
|
||||
@@ -239,4 +279,4 @@ class PlaceVoting(PlaceAsset):
|
||||
return PLACE_LEVELS[self.vote - 1][1]
|
||||
|
||||
def get_all_choices(self):
|
||||
return reversed(PLACE_LEVELS)
|
||||
return reversed(PLACE_LEVELS)
|
||||
|
||||
Reference in New Issue
Block a user