Yohan Boniface  committed c6316ee

Update map delete and clone views (cf yohanboniface/Leaflet.Storage#62)

  • Participants
  • Parent commits 7492bef

Comments (0)

Files changed (2)

File leaflet_storage/

 from django.core.signing import Signer
 from django.contrib import messages
 from django.template.defaultfilters import slugify
+from django.core.files.base import File
 from .fields import DictField
  = None
         if map_inst:
    = map_inst
+        new.geojson = File(new.geojson.file.file)
-        for feature in self.features:
-            feature.clone(datalayer=new)
         return new

File leaflet_storage/

     model = Map
     pk_url_kwarg = "map_id"
-    def render_to_response(self, context, **response_kwargs):
-        return render_to_json(self.get_template_names(), response_kwargs, context, self.request)
     def delete(self, *args, **kwargs):
         self.object = self.get_object()
         if not self.request.user == self.object.owner:
         return simple_json_response(redirect="/")
-    def get_context_data(self, **kwargs):
-        kwargs.update({
-            'action_url': reverse_lazy('map_delete', kwargs={'map_id': self.kwargs['map_id']})
-        })
-        return super(MapDelete, self).get_context_data(**kwargs)
 class MapClone(View):
-    def get(self, *args, **kwargs):
+    def post(self, *args, **kwargs):
         if not getattr(settings, "LEAFLET_STORAGE_ALLOW_ANONYMOUS", False) \
            and not self.request.user.is_authenticated():
             return HttpResponseForbidden('Forbidden')