def delete_bugurt(request, name): bugurt = Bugurt.get_by_name(name) if request.user.username == bugurt.author.username: bugurt.delete() return HttpResponseRedirect("/user/%s/" % request.user) else: return HttpResponseRedirect('/')
def edit_bugurt(request, name): bugurt = Bugurt.get_by_name(name) if request.user.username == bugurt.author.username: if request.POST: edit_form = EditBugurt(request.POST) if edit_form.is_valid(): bugurt.name = edit_form.cleaned_data['name'] bugurt.text = edit_form.cleaned_data['text'] bugurt.save() else: edit_form = EditBugurt({'name': bugurt.name, 'text': bugurt.text}) return {'edit_form': edit_form, 'bugurt': bugurt, 'tag_add': AddTag(), 'proof_add': AddProof()} else: return HttpResponseRedirect(bugurt.get_absolute_url())
def view_bugurt(request, bugurt): return {'bugurt': Bugurt.get_by_name(bugurt)}