示例#1
0
文件: views.py 项目: xnx99/enjaz
def list_registrations(request):
    if not utils.is_organizing_committee_member(request.user) and \
       not request.user.is_superuser:
        raise PermissionDenied

    sessions = Session.objects.all()
    return render(request, "hpc/registration_list.html",
                  {'sessions': sessions})
示例#2
0
文件: views.py 项目: xnx99/enjaz
def introduce_registration(request):
    if datetime.now() > datetime(2016, 1, 17, 23, 59):
        return HttpResponseRedirect(reverse('hpc:registration_closed'))
    if request.user.is_authenticated() and \
       not utils.is_organizing_committee_member(request.user) and \
       not request.user.is_superuser:
        return HttpResponseRedirect(reverse('hpc:user_registration'))
    else:
        return render(request, "hpc/registration_introduction.html")
示例#3
0
文件: views.py 项目: xnx99/enjaz
def list_abstracts(request):
    if not utils.is_research_committee_member(request.user) and \
       not utils.is_organizing_committee_member(request.user) and \
       not request.user.is_superuser:
        raise PermissionDenied

    pending_abstracts = Abstract.objects.filter(is_deleted=False, evaluation__isnull=True)
    evaluated_abstracts = Abstract.objects.filter(is_deleted=False, evaluation__isnull=False)

    # The Research Committee is only concerned about abstracts from
    # the university.  The rest will be evaluated by the Organizing
    # Committee.
    if utils.is_research_committee_member(request.user):
        pending_abstracts = pending_abstracts.filter(university="KSAU-HS")
        evaluated_abstracts = evaluated_abstracts.filter(university="KSAU-HS")
    elif utils.is_organizing_committee_member(request.user):
        pending_abstracts = pending_abstracts.exclude(university="KSAU-HS")
        evaluated_abstracts = evaluated_abstracts.exclude(university="KSAU-HS")

    context = {'pending_abstracts': pending_abstracts,
               'evaluated_abstracts': evaluated_abstracts}

    return render(request, 'hpc/list_abstracts.html', context)
示例#4
0
文件: views.py 项目: xnx99/enjaz
def show_abstract(request, pk):
    if not utils.is_research_committee_member(request.user) and \
       not utils.is_organizing_committee_member(request.user) and \
       not request.user.is_superuser:
        raise PermissionDenied

    abstract = get_object_or_404(Abstract, pk=pk, is_deleted=False)
    try:
        evaluation = abstract.evaluation
    except Evaluation.DoesNotExist:
        evaluation = Evaluation(evaluator=request.user,
                                abstract=abstract)

    if request.method == 'POST':
        form = EvaluationForm(request.POST, instance=evaluation)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse('hpc:list_abstracts'))
    elif request.method == 'GET':
        form = EvaluationForm(instance=evaluation)

    return render(request, "hpc/show_abstract.html",
                  {'abstract': abstract, 'form': form})
示例#5
0
文件: hpc_tags.py 项目: xnx99/enjaz
def is_organizing_committee_member(user):
    return utils.is_organizing_committee_member(user)
示例#6
0
def is_organizing_committee_member(user):
    return utils.is_organizing_committee_member(user)