def home(request): if request.user.is_authenticated(): roles = get_roles(request.user) badroles = ('B-18000-STUDENT' not in roles and 'B-18000-SUMA-ZAMESTNANEC' not in roles and 'B-18000-UCASTNIK-CZV' not in roles) if badroles: auth_logout(request) teacher = 'B-18000-SUMA-ZAMESTNANEC' in roles else: badroles = False teacher = False signed_list = models.Signature.objects.filter( signed=True).order_by('-timestamp') paginator = Paginator(signed_list, 45) total = signed_list.count() page = request.GET.get('page') try: signatures = paginator.page(page) except PageNotAnInteger: signatures = paginator.page(1) except EmptyPage: signatures = paginator.page(paginator.num_pages) return render_to_response( 'index.html', { 'user': request.user, 'badroles': badroles, 'teacher': teacher, 'signatures': signatures, 'total': total, }, RequestContext(request))
def home(request): if request.user.is_authenticated(): roles = get_roles(request.user) badroles = ( "B-18000-STUDENT" not in roles and "B-18000-ZAMESTNANEC" not in roles and "B-18000-UCASTNIK-CZV" not in roles ) if badroles: auth_logout(request) teacher = "B-18000-ZAMESTNANEC" in roles else: badroles = False teacher = False signed_list = models.Signature.objects.filter(signed=True).order_by("-timestamp") paginator = Paginator(signed_list, 45) total = signed_list.count() page = request.GET.get("page") try: signatures = paginator.page(page) except PageNotAnInteger: signatures = paginator.page(1) except EmptyPage: signatures = paginator.page(paginator.num_pages) return render_to_response( "index.html", {"user": request.user, "badroles": badroles, "teacher": teacher, "signatures": signatures, "total": total}, RequestContext(request), )
def detail(user): if user.get_full_name(): output = "%s (%s)" % (user.get_full_name(), user.username) else: output = user.username roles = get_roles(user) if "B-18000-ZAMESTNANEC" in roles: output += ' <span class="label label-info">zaměstnanec</span>' if "B-18000-STUDENT" in roles: output += ' <span class="label label-primary">student</span>' if "B-18000-UCASTNIK-CZV" in roles: output += ' <span class="label label-default">cžv</span>' return mark_safe(output)
def detail(user): if user.get_full_name(): output = '%s (%s)' % (user.get_full_name(), user.username) else: output = user.username roles = get_roles(user) if 'B-18000-ZAMESTNANEC' in roles: output += ' <span class="label label-info">zaměstnanec</span>' if 'B-18000-STUDENT' in roles: output += ' <span class="label label-primary">student</span>' if 'B-18000-UCASTNIK-CZV' in roles: output += ' <span class="label label-default">cžv</span>' return mark_safe(output)