Yohan Boniface  committed dad6aa1

Add a message when anonymous map is attached to authenticated user

  • Participants
  • Parent commits dc3d796

Comments (0)

Files changed (2)

File leaflet_storage/

 from django.contrib.auth.models import User
 from django.utils.translation import ugettext as _
 from django.core.signing import Signer
+from django.contrib import messages
 from .fields import DictField
                 can = True
                 if user and user.is_authenticated():
                     # if user is authenticated, attach as owner
-                    # TODO, display a message
                     self.owner = user
+                    msg = _("Your anonymous map has been attached to your account %s" % user)
+          , msg)
         elif self.edit_status == self.ANONYMOUS:
             can = True
         elif not user.is_authenticated():

File leaflet_storage/

                 locale = self.request.LANGUAGE_CODE
             map_settings['locale'] = locale
         if self.request.user.is_authenticated():
-            allow_edit = int(self.object.can_edit(self.request.user))
+            allow_edit = int(self.object.can_edit(self.request.user, self.request))
             # Default to 1: display buttons for anonymous, they can
             # login from action process