Exemplo n.º 1
0
def person_add(request):
    site = get_current_site(request)
    if request.method == "POST":
        form = PersonForm(request.POST)
        if form.is_valid():
            person = form.save()
            action = Action(timestamp=datetime.now(), is_public=True, actor=request.user, verb="ad", person=person)
            action.save()
            return HttpResponseRedirect(reverse("person", args=[person.id]))
    else:
        form = PersonForm()
    return render_to_response("poplar/person_add.html", locals(), context_instance=RequestContext(request))
Exemplo n.º 2
0
def note_add(request, person_id):
    subject = get_object_or_404(Person, id=person_id)
    if request.method == "POST":
        form = NoteForm(request.POST, author=request.user, subject=subject)
        if form.is_valid():
            note = form.save()
            action = Action(
                timestamp=datetime.now(),
                is_public=note.is_public,
                actor=request.user,
                verb="wr",
                note=note,
                person=subject,
            )
            action.save()
            return HttpResponseRedirect(reverse("person", args=[subject.id]))
    return person(request, person_id)