예제 #1
0
파일: views.py 프로젝트: demidov91/curs4
def accept_adv(request, campaign_id):
    campaign_node = Campaign.nodes.get_or_none(id=campaign_id)
    if not campaign_node:
        raise Http404()
    acceptor = get_profile_node(request.user)
    graph_db.get_or_create_relationships((campaign_node, Campaign.ACCEPTED_RELATION, acceptor, {'time': datetime_serialize(datetime.now())}))
    messages.info(request, 'Proposal was successfully accepted.')
    return redirect('show_adv', campaign_id=campaign_id)
예제 #2
0
파일: views.py 프로젝트: demidov91/curs4
def show_adv(request,campaign_id):
    campaign = get_object_or_404(Campaign.objects, id=campaign_id)
    request.session['last_seen_adv'] = campaign
    campaign_node = campaign.get_node()
    is_accepted = campaign_node.is_related_to(get_profile_node(request.user), 0, Campaign.ACCEPTED_RELATION)
    return render(request, 'advert.html', {
        'campaign': campaign,
        'is_accepted': is_accepted,
        })
예제 #3
0
파일: views.py 프로젝트: pombredanne/curs4
def accept_adv(request, campaign_id):
    campaign_node = Campaign.nodes.get_or_none(id=campaign_id)
    if not campaign_node:
        raise Http404()
    acceptor = get_profile_node(request.user)
    graph_db.get_or_create_relationships(
        (campaign_node, Campaign.ACCEPTED_RELATION, acceptor, {"time": datetime_serialize(datetime.now())})
    )
    messages.info(request, "Proposal was successfully accepted.")
    return redirect("show_adv", campaign_id=campaign_id)
예제 #4
0
파일: views.py 프로젝트: pombredanne/curs4
def show_adv(request, campaign_id):
    campaign = get_object_or_404(Campaign.objects, id=campaign_id)
    request.session["last_seen_adv"] = campaign
    campaign_node = campaign.get_node()
    is_accepted = campaign_node.is_related_to(get_profile_node(request.user), 0, Campaign.ACCEPTED_RELATION)
    return render(request, "advert.html", {"campaign": campaign, "is_accepted": is_accepted})