
def user_is_census_admin(user):
    return user.is_authenticated() and user.is_census_admin


def user_is_group_admin(user, group):
    return user.is_authenticated() and (user.is_census_admin or
                                        group.admin == user)


def user_has_online_training(user):
    return user.is_authenticated() and user.online_training_complete


def user_has_field_training(user):
    return user.is_authenticated() and user.field_training_complete


def user_is_individual_mapper(user):
    return user.is_authenticated() and user.individual_mapper

from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division

from apps.users.models import TrustedMapper


def user_is_census_admin(user):
    return user.is_authenticated() and user.is_census_admin


def user_is_group_admin(user, group):
    return user.is_authenticated() and (user.is_census_admin or
                                        group.admin == user)


def user_has_online_training(user):
    return user.is_authenticated() and user.online_training_complete


def user_has_field_training(user):
    return user.is_authenticated() and user.field_training_complete


def user_is_individual_mapper(user):
    return user.is_authenticated() and user.individual_mapper


def user_is_trusted_mapper(user, group):
    return user.is_authenticated() and \
        TrustedMapper.objects.filter(group=group,
                                     user=user,
                                     is_approved=True).exists()

Hide "Request Individual Mapper Status" button if approved
Hide "Request Individual Mapper Status" button if approved

There's no point to showing this button once you have been approved as
an individual mapper for this group.

+ from __future__ import print_function
+ from __future__ import unicode_literals
+ from __future__ import division
+ 
+ from apps.users.models import TrustedMapper
+ 
  
  def user_is_census_admin(user):
      return user.is_authenticated() and user.is_census_admin
  
  
  def user_is_group_admin(user, group):
      return user.is_authenticated() and (user.is_census_admin or
                                          group.admin == user)
  
  
  def user_has_online_training(user):
      return user.is_authenticated() and user.online_training_complete
  
  
  def user_has_field_training(user):
      return user.is_authenticated() and user.field_training_complete
  
  
  def user_is_individual_mapper(user):
      return user.is_authenticated() and user.individual_mapper
  
+ 
+ def user_is_trusted_mapper(user, group):
+     return user.is_authenticated() and \
+         TrustedMapper.objects.filter(group=group,
+                                      user=user,
+                                      is_approved=True).exists()
+ 
Hide "Request Individual Mapper Status" button if approved
## Code Before:

def user_is_census_admin(user):
    return user.is_authenticated() and user.is_census_admin


def user_is_group_admin(user, group):
    return user.is_authenticated() and (user.is_census_admin or
                                        group.admin == user)


def user_has_online_training(user):
    return user.is_authenticated() and user.online_training_complete


def user_has_field_training(user):
    return user.is_authenticated() and user.field_training_complete


def user_is_individual_mapper(user):
    return user.is_authenticated() and user.individual_mapper

## Instruction:
Hide "Request Individual Mapper Status" button if approved
## Code After:
from __future__ import print_function
from __future__ import unicode_literals
from __future__ import division

from apps.users.models import TrustedMapper


def user_is_census_admin(user):
    return user.is_authenticated() and user.is_census_admin


def user_is_group_admin(user, group):
    return user.is_authenticated() and (user.is_census_admin or
                                        group.admin == user)


def user_has_online_training(user):
    return user.is_authenticated() and user.online_training_complete


def user_has_field_training(user):
    return user.is_authenticated() and user.field_training_complete


def user_is_individual_mapper(user):
    return user.is_authenticated() and user.individual_mapper


def user_is_trusted_mapper(user, group):
    return user.is_authenticated() and \
        TrustedMapper.objects.filter(group=group,
                                     user=user,
                                     is_approved=True).exists()
