Ejemplo n.º 1
0
 def page_context(self):
     from corehq.apps.users.views.mobile import GroupsListView
     context = {
         'are_groups': bool(len(self.all_groups)),
         'groups_url': reverse('all_groups', args=[self.domain]),
         'group_form': self.group_form,
         'reset_password_form': self.reset_password_form,
         'is_currently_logged_in_user': self.is_currently_logged_in_user,
         'data_fields_form': self.form_user_update.custom_data.form,
         'can_use_inbound_sms': domain_has_privilege(self.domain, privileges.INBOUND_SMS),
         'can_create_groups': (
             self.request.couch_user.has_permission(self.domain, 'edit_commcare_users') and
             self.request.couch_user.has_permission(self.domain, 'access_all_locations')
         ),
         'needs_to_downgrade_locations': (
             users_have_locations(self.domain) and
             not has_privilege(self.request, privileges.LOCATIONS)
         ),
         'demo_restore_date': naturaltime(demo_restore_date_created(self.editable_user)),
         'hide_password_feedback': settings.ENABLE_DRACONIAN_SECURITY_FEATURES
     }
     if self.commtrack_form.errors:
         messages.error(self.request, _(
             "There were some errors while saving user's locations. Please check the 'Locations' tab"
         ))
     if self.domain_object.commtrack_enabled or self.domain_object.uses_locations:
         context.update({
             'commtrack_enabled': self.domain_object.commtrack_enabled,
             'uses_locations': self.domain_object.uses_locations,
             'commtrack': {
                 'update_form': self.commtrack_form,
             },
         })
     return context
Ejemplo n.º 2
0
 def page_context(self):
     context = {
         'are_groups':
         bool(len(self.all_groups)),
         'groups_url':
         reverse('all_groups', args=[self.domain]),
         'group_form':
         self.group_form,
         'reset_password_form':
         self.reset_password_form,
         'is_currently_logged_in_user':
         self.is_currently_logged_in_user,
         'data_fields_form':
         self.custom_data.form,
         'can_use_inbound_sms':
         domain_has_privilege(self.domain, privileges.INBOUND_SMS),
         'needs_to_downgrade_locations':
         (users_have_locations(self.domain)
          and not has_privilege(self.request, privileges.LOCATIONS)),
         'demo_restore_date':
         naturaltime(demo_restore_date_created(self.editable_user)),
         'hide_password_feedback':
         settings.ENABLE_DRACONIAN_SECURITY_FEATURES
     }
     if self.domain_object.commtrack_enabled or self.domain_object.uses_locations:
         context.update({
             'commtrack_enabled': self.domain_object.commtrack_enabled,
             'uses_locations': self.domain_object.uses_locations,
             'commtrack': {
                 'update_form': self.update_commtrack_form,
             },
         })
     return context
Ejemplo n.º 3
0
 def page_context(self):
     context = {
         'are_groups': bool(len(self.all_groups)),
         'groups_url': reverse('all_groups', args=[self.domain]),
         'group_form': self.group_form,
         'reset_password_form': self.reset_password_form,
         'is_currently_logged_in_user': self.is_currently_logged_in_user,
         'data_fields_form': self.custom_data.form,
         'can_use_inbound_sms': domain_has_privilege(self.domain, privileges.INBOUND_SMS),
         'needs_to_downgrade_locations': (
             users_have_locations(self.domain) and
             not has_privilege(self.request, privileges.LOCATIONS)
         ),
         'demo_restore_date': naturaltime(demo_restore_date_created(self.editable_user)),
         'hide_password_feedback': settings.ENABLE_DRACONIAN_SECURITY_FEATURES
     }
     if self.commtrack_form.errors:
         messages.error(self.request, _(
             "There were some errors while saving user's locations. Please check the 'Locations' tab"
         ))
     if self.domain_object.commtrack_enabled or self.domain_object.uses_locations:
         context.update({
             'commtrack_enabled': self.domain_object.commtrack_enabled,
             'uses_locations': self.domain_object.uses_locations,
             'commtrack': {
                 'update_form': self.commtrack_form,
             },
         })
     return context