def add_user_point(u_username): u_user = User.objects.get(username=u_username) try: ur = UserReputation.objects.get(user=u_user) ur.reputation = ur.reputation + 1 ur.save() except UserReputation.DoesNotExist: ur = UserReputation(user=u_user, reputation=1) ur.save()
def save_university(u_username, u_university): u_user = User.objects.get(username=u_username) try: ur = UserReputation.objects.get(user=u_user) ur.university = u_university ur.save() except UserReputation.DoesNotExist: ur = UserReputation(user=u_user, reputation=1, university=u_university) ur.save()
def insert_user_reputation(u_username, u_reputation): u_user = User.objects.get(username=u_username) ur = UserReputation(user=u_user, reputation=u_reputation) ur.save