Exemple #1
0
def _insert_or_update_vote(cart, category, team):
    try:
        vote = Vote.objects.get(cart=cart, category=category)
        if team is None:
            vote.delete()
        else:
            vote.team = team
            vote.save()
    except:
        if team is not None:
            vote = Vote(cart=cart, category=category, team=team)
            vote.save()
Exemple #2
0
def _insert_or_update_vote(cart, category, team):
    if team is not None and category is not None:
        if ((category.is_concept and team.is_implemented)
                or (category.is_implemented and team.is_concept)):
            raise Exception("invalid concept/implemenation match")

    try:
        vote = Vote.objects.get(cart=cart, category=category)
        if team is None:
            vote.delete()
        else:
            vote.team = team
            vote.save()
    except:
        if team is not None:
            vote = Vote(cart=cart, category=category, team=team)
            vote.save()
Exemple #3
0
def _insert_or_update_vote(cart, category, team):
    if team is not None and category is not None:
        if ((category.is_concept and team.is_implemented) or
            (category.is_implemented and team.is_concept)):
            raise Exception("invalid concept/implemenation match")

    try:
        vote = Vote.objects.get(cart=cart, category=category)
        if team is None:
            vote.delete()
        else:
            vote.team = team
            vote.save()
    except:
        if team is not None:
            vote = Vote(cart=cart, category=category, team=team)
            vote.save()