def accept_completion(request, id): completion = get_object_or_404(QuestCompletion, pk=id) completion.confirmed = True completion.save() send_message('quest_completion_accepted', {}, {'completion':completion}, completion.zed.user.email) #achievement to quest completor Achievement.objects.create( zed = completion.zed, quest = completion.quest, action = "%s %s" % ("Completed quest", completion.quest.name), exp_earned = 5 * completion.quest.difficulty, geld_earned = 5 * completion.quest.difficulty, timestamp = completion.time_submitted ) if completion.quest.creator != completion.zed: #achievement to quest creator Achievement.objects.create( zed = completion.quest.creator, quest = completion.quest, action = "%s %s %s" % (completion.zed.name, "completed quest", completion.quest.name), exp_earned = 1 * completion.quest.difficulty, geld_earned = 1 * completion.quest.difficulty, timestamp = completion.time_submitted ) return HttpResponseRedirect(reverse('completion_list'))
def reject_completion(request, id): completion = get_object_or_404(QuestCompletion, pk=id) completion.rejected = True completion.save() send_message('quest_completion_rejected', {}, {'completion':completion}, completion.zed.user.email) return HttpResponseRedirect(reverse('completion_list'))