Example #1
0
 def display_auth_key(self, obj):
     if obj.auth_key:
         return _format(
             "<span class='glyphicon glyphicon-remove' style='color: #922;'></span>"
         )
     else:
         return _format(
             "<span class='glyphicon glyphicon-ok' style='color: #262;'></span>"
         )
Example #2
0
    def display_is_active(self, obj):
        if obj.is_active:
            is_ok = "<span class='glyphicon glyphicon-ok' style='color: #262'></span>"
        else:
            is_ok = "<span class='glyphicon glyphicon-remove' style='color: #922'></span>"

        return _format(is_ok)
Example #3
0
    def display_full_name(self, obj):
        if obj.first_name or obj.last_name:
            name = obj.first_name if obj.first_name else ''
            name += " " if obj.first_name and obj.last_name else ''
            name += obj.last_name if obj.last_name else ''
            name += " " if obj.last_name else ''
            name += "<span class='label' style='border-radius: 20rem;background-color: #666'>%s</span>" % obj.username
        else:
            name = obj.username

        return _format(name)
Example #4
0
    def display_full_name(self, obj):
        full = "%s %s" % (obj.first_name, obj.last_name) + (
            " (%s)" % obj.user.username if obj.user_id else "")

        if obj.is_manager:
            full += " <span class='label label-success'>%s</span>" % "Менеджер"

        if obj.is_fired:
            full += " <span class='label label-danger'>%s</span>" % "Уволен"

        if obj.user:
            if obj.user.is_staff:
                full += " <span class='label label-info'>%s</span>" % "Сотрудник"
            if obj.user.is_superuser:
                full += " <span class='label label-primary'>%s</span>" % "Администратор"

        return _format(full)