Beispiel #1
0
def _people_conversations_tab_context(context):
    conversation_form = NewConversationForm(account=context["request"].account)
    conversation_form.initial["staff"] = context["request"].useraccount
    new_start_index = 3
    context.update(
        {
            "conversation_form": conversation_form,
            "CONVERSATION_TYPES": CONVERSATION_TYPES,
            "new_start_index": new_start_index,
        }
    )

    return context
Beispiel #2
0
def save_new_conversation(request, person_id):
    person = get_or_404_by_account(Person, request.account, person_id, using="default")
    obj = person
    if request.method == "POST":
        form = NewConversationForm(request.POST, account=request.account)
        if form.is_valid():
            new_conversation = form.save(commit=False)
            new_conversation.person = person
            new_conversation.save()
            try:
                transaction.commit()
            except:
                pass
            save_action.delay(
                request.account,
                request.useraccount,
                "added a conversation",
                person=person,
                conversation=new_conversation,
            )
        else:
            print form

    return _return_fragments_or_redirect(request, locals())