예제 #1
0
def unsubscribe(request, id):
    c = Contact.objects.get(id=id)
    if request.GET.get('confirm', None):
        c.do_not_email = True
        c.save()
        ch = ContactEditHistory(contact=c, message="The contact has unsubscribed.")
        ch.save()
        return direct_to_template(request, template="emails/unsubscribe.html")

    else:
        return direct_to_template(request, extra_context = locals(), template="emails/unsubscribe_confirm.html")
예제 #2
0
def contacteditlog(request, contact, message):
    """
    Adds a record to the contact's edit history.

    arguments:
        *request* - The request object
        *contact* - The contact being edited
        *message* - A description of what happened

    return:
        none
    """
    hist = ContactEditHistory(user=request.user,
                       contact=contact,
                       event_date=datetime.strftime(datetime.now(), "%Y-%m-%d %H:%M:%S"),
                       message=message)
    hist.save()