Make sure map name is always read from backend

fix #605
This commit is contained in:
Yohan Boniface 2018-08-04 15:26:12 +02:00
parent c143c2c7ab
commit e319fa963e
2 changed files with 5 additions and 3 deletions

View file

@ -189,7 +189,8 @@ class Map(NamedModel):
elif request.user == self.owner:
can = True
else:
can = not (self.share_status == self.PRIVATE and request.user not in self.editors.all())
can = not (self.share_status == self.PRIVATE
and request.user not in self.editors.all())
return can
@property
@ -204,7 +205,7 @@ class Map(NamedModel):
new.pk = None
new.name = u"%s %s" % (_("Clone of"), self.name)
if "owner" in kwargs:
# can be None in case of anonymous cloning
# can be None in case of anonymous cloning
new.owner = kwargs["owner"]
new.save()
for editor in self.editors.all():

View file

@ -350,7 +350,7 @@ class MapDetailMixin:
model = Map
def get_context_data(self, **kwargs):
context = super(MapDetailMixin, self).get_context_data(**kwargs)
context = super().get_context_data(**kwargs)
properties = {
'urls': _urls_for_js(),
'tilelayers': TileLayer.get_list(),
@ -447,6 +447,7 @@ class MapView(MapDetailMixin, DetailView):
map_settings = self.object.settings
if "properties" not in map_settings:
map_settings['properties'] = {}
map_settings['properties']['name'] = self.object.name
permissions = {}
permissions['edit_status'] = self.object.edit_status
permissions['share_status'] = self.object.share_status