All Projects → divio → Django Mailchimp

divio / Django Mailchimp

Licence: other
DEPRECATED, this project is no longer maintained, see README for more information.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Django Mailchimp

Intern Only Dojo
DEPRECATED - See dojo/meta for the latest on Dojo 2
Stars: ✭ 123 (-28.49%)
Mutual labels:  deprecated
Vip Scanner
Deprecated: Scan all sorts of themes and files and things! Use PHPCS and the VIP coding standards instead
Stars: ✭ 143 (-16.86%)
Mutual labels:  deprecated
Cudlr
⛔️ [DEPRECATED] Console for Unity Debugging and Logging Remotely
Stars: ✭ 167 (-2.91%)
Mutual labels:  deprecated
React Panels
React.js panel widget with support for tabs, toolbars, buttons and customizable themes
Stars: ✭ 128 (-25.58%)
Mutual labels:  deprecated
Gh
(DEPRECATED) GitHub CLI made with NodeJS
Stars: ✭ 1,701 (+888.95%)
Mutual labels:  deprecated
Redditkit.rb
[Deprecated] A Ruby wrapper for the reddit API
Stars: ✭ 156 (-9.3%)
Mutual labels:  deprecated
Python Firebase
⛔️ [DEPRECATED] python wrapper for Firebase's REST API
Stars: ✭ 117 (-31.98%)
Mutual labels:  deprecated
Retour
DEPRECATED Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
Stars: ✭ 172 (+0%)
Mutual labels:  deprecated
Httpserver.jl
DEPRECATED! Basic, non-blocking HTTP server in Julia.
Stars: ✭ 138 (-19.77%)
Mutual labels:  deprecated
Keras Metrics
Metrics for Keras. DEPRECATED since Keras 2.3.0
Stars: ✭ 164 (-4.65%)
Mutual labels:  deprecated
Bselect
DEPRECATED - The select decorator component that was missing for Twitter Bootstrap.
Stars: ✭ 129 (-25%)
Mutual labels:  deprecated
Nexpose Client
DEPRECATED: Rapid7 Nexpose API client library written in Ruby
Stars: ✭ 134 (-22.09%)
Mutual labels:  deprecated
Sphero Android Sdk
🚫 DEPRECATED REPO: Sphero™ is the amazing robotic ball ( gosphero.com ), this is the repository for the Android SDK for Sphero™. Visit dev site for more information:
Stars: ✭ 160 (-6.98%)
Mutual labels:  deprecated
Ticons Server Php
⛔️ REPLACED BY NODE.JS VERSION:
Stars: ✭ 127 (-26.16%)
Mutual labels:  deprecated
Ofxlibwebsockets
[Deprecated] openFrameworks wrapper of libwebsockets for WebSocket client and server functionality
Stars: ✭ 171 (-0.58%)
Mutual labels:  deprecated
Go Web3
Ethereum Go Client [obsolete]
Stars: ✭ 120 (-30.23%)
Mutual labels:  deprecated
Jquery Simulate Ext
jQuery simulate extended
Stars: ✭ 144 (-16.28%)
Mutual labels:  deprecated
Gulp Traceur
Traceur is a JavaScript.next to JavaScript-of-today compiler
Stars: ✭ 172 (+0%)
Mutual labels:  deprecated
Venator
[⛔️ Deprecated] Venator is a python tool used to gather data for proactive detection of malicious activity on macOS devices.
Stars: ✭ 172 (+0%)
Mutual labels:  deprecated
Elasto
DEPRECATED: Simple library to query Elasticsearch
Stars: ✭ 163 (-5.23%)
Mutual labels:  deprecated

Deprecated

This project is no longer supported.

Divio will undertake no further development or maintenance of this project. If you are interested in taking responsibility for this project as its maintainer, please contact us via www.divio.com.

===================== Django Mailchimp v1.3

This is an integrated app for Django dealing with the Mailchimp mailing list system.

.. warning:: This package used to be called simply django-mailchimp. But since the mailchimp API changed in non-backwards-compatible ways between v1.2 and v1.3, we renamed it to django-mailchimp-v1.3.

Stuff may break in funny ways with this release, so make sure to thoroughly
test your code if you want to update from ``django-mailchimp``.

Quick start guide:

Installation:


  1. Install django-mailchimp-v1.3::

    pip install django-mailchimp-v1.3

  2. Add a MAILCHIMP_API_KEY to your settings.py with your mailchimp API key as the value (obviously)

  3. Add mailchimp to your project's list of INSTALLED_APPS

  4. To start using the API, you should start by using utils.get_connection(). This will use the API_KEY you just defined in settings.py

Subscribing a user to a list:


  1. To get the list::

    list = mailchimp.utils.get_connection().get_list_by_id()

  2. Now add a member to the mailing list::

    list.subscribe('[email protected]', {'EMAIL':'[email protected]'})

Those pesky merge vars:

General info:


Mailchimp is a quite generic service. As such, it needs to store information on people who subscribe to a list, and that information is specific to this very list!

So to help you build dynamic forms (presumabely), mailchimp added the merge_vars. They are, basically, a dictionnary showing infromation and meta-information defined for each piece of information. Here's what the default set of merge vars look like (ona brand new list with default options)::

[
    {
    'field_type': 'email', 
    'name': 'Email Address', 
    'show': True, 
    'default': None, 
    'req': True, 
    'public': True, 
    'tag': 'EMAIL', 
    'helptext': None, 
    'order': '1', 
    'size': '25'
    },{
    'field_type': 'text', 
    'name': 'First Name', 
    'show': True, 
    'default': '', 
    'req': False, 
    'public': True, 
    'tag': 'FNAME', 
    'helptext': '', 
    'order': '2', 
    'size': '25'
    },{
    'field_type': 'text', 
    'name': 'Last Name', 
    'show': True, 
    'default': '', 
    'req': False, 
    'public': True, 
    'tag': 'LNAME', 
    'helptext': '', 
    'order': '3', 
    'size': '25'
    }
]

As you can see, it's a list of 3 dictionnaries, each containing several fields that you should use to build your user interface with (since you're using this app, that means your Django form).

Obtaining them:


You can recreate this list using the following API call::

list = mailchimp.utils.get_connection().get_list_by_id(<The list's key ID>)
print list.merges

Using them:


When you make a post to mailchimp, you need to pass merge_vars. For example, in a new list created with the default settings on the mailchimp website, the following call adds a member to a list (with a little more info than our bare minimum example up there)::

list = mailchimp.utils.get_connection().get_list_by_id(<The list's key ID>)
list.subscribe('[email protected]', {'EMAIL': '[email protected]', 'FNAME': 'Monthy', 'LNAME': 'Pythons'})

Note the use of the 'tag' field as the key for fields (why they didn't call it 'key' or 'id' is beyond comprehension).

Create a view:

We'll now try to move up the stack and create the necessary elements to make a useable mailchimp interface

Fire up your favorite editor and open your views.py. Put in the following snippet of code::

from django.http import HttpResponseRedirect
from mailchimp import utils

MAILCHIMP_LIST_ID = 'spamspamspamspameggsspamspam' # DRY :)
REDIRECT_URL_NAME = '/mailing_list_success/'
def add_email_to_mailing_list(request):
    if request.POST['email']:
        email_address = request.POST['email']
        list = utils.get_connection().get_list_by_id(MAILCHIMP_LIST_ID)
        list.subscribe(email_address, {'EMAIL': email_address})
        return HttpResponseRedirect('/mailing_list_success/')
    else:
        return HttpResponseRedirect('/mailing_list_failure/')

Of course, if you feel redirecting the user is not the right approach (handling a form might be a good idea), feel free to adapt this simple example to your needs :p

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].