Commits

Yohan Boniface committed dad6aa1

Add a message when anonymous map is attached to authenticated user

  • Participants
  • Parent commits dc3d796

Comments (0)

Files changed (2)

leaflet_storage/base_models.py

 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
                     self.save()
+                    msg = _("Your anonymous map has been attached to your account %s" % user)
+                    messages.info(request, msg)
         elif self.edit_status == self.ANONYMOUS:
             can = True
         elif not user.is_authenticated():

leaflet_storage/views.py

                 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))
         else:
             # Default to 1: display buttons for anonymous, they can
             # login from action process