My very small django-campaign

6 views
Skip to first unread message

Jökull

unread,
Aug 8, 2007, 2:00:42 PM8/8/07
to django-mailer
http://dpaste.com/16350/

Here is my campaign app model. There are bits of icelandic there but
nothing to hamper understanding i hope.

It's a three-way Email, Campaign, Dispatch.

For my purposes I've hard-coded a template into the Dispatch.send()
method where the actual emailing gets done. Ideally it should be
multipart and send a plain-text along with it. The email address of
each user is put into the email for an unsubscribe link. Again -
ideally this should be a unique hash key do couple the unregistration
with the email that was used to unregister. Custom templates would be
nice for differently themed emails.

The way I've done this everything is controlled in the django admin.
Campaign.dispatched() gives you the completed percentage etc.

As described on django-users there is a cronjob running a tiny script:
http://dpaste.com/16353/

Hope this is useful to your goals. I'm really interested in what
functionality you're looking for passed what I have down in my puny
little app.

James Tauber

unread,
Aug 9, 2007, 4:19:44 AM8/9/07
to django...@googlegroups.com

On 08/08/2007, at 2:00 PM, Jökull wrote:

>
> http://dpaste.com/16350/
>
> Here is my campaign app model. There are bits of icelandic there but
> nothing to hamper understanding i hope.

Ah, you're Icelandic. That explains my inability to classify in my
own mind whether your name was Danish, Norwegian or Swedish.
Auðunsson just didn't fit my naïve mental model :-)

James

Jökull Auðunsson

unread,
Aug 9, 2007, 5:16:11 AM8/9/07
to django...@googlegroups.com
It's impressive you were even trying to distinguish it apart from the other -"son" countries!

Did you have a look at the code? Something I forgot to note is that it hasn't gone through rigorous testing at all. The first site that will use it was just put live yesterday. In the coming weeks there will hopefully be some mailings.

Jökull

James Tauber

unread,
Aug 9, 2007, 5:50:06 AM8/9/07
to django...@googlegroups.com
On 09/08/2007, at 5:16 AM, Jökull Auðunsson wrote:

> It's impressive you were even trying to distinguish it apart from
> the other -"son" countries!

The ö ruled out Danish or Norwegian. So I was all ready to assume
Swedish when I saw the ð. I was fairly confident Swedish didn't have
a ð. I forgot Icelandic did.

Sorry to everyone else -- I'm a linguist by training and can't resist
this sort of thing :-)

> Did you have a look at the code? Something I forgot to note is that
> it hasn't gone through rigorous testing at all. The first site that
> will use it was just put live yesterday. In the coming weeks there
> will hopefully be some mailings.

Looking at it now.

I can see from your Email model why you didn't understand the "don't
send list" at first. Because you have a separate list of email
address, you're solving the same problem a different way. The main
difference is you know about all your emails addresses internal to
your system whereas (at least at the lowest layer of the
architecture) my system just gets given email addresses.

Campaign is very similar to what I was considering as the model that
groups the mailing of the same template in bulk. Obviously your
Campaign is tied to a domain object -- Event -- which mine won't do.
Am I right in thinking that if you have a "preview", the campaign
message is sent to just that address but if it's blank, it's sent to
every active email address? So to send a campaign out, you simply
remove the preview address and re-save?

Dispatch is most closely related to what I have done.

Regarding templates, I was thinking that my equivalent of your
Campaign model would contain the name of the template to use, rather
than it be hard-coded in the dispatch. I presume to send different
email for different campaigns, you currently need conditional logic
in your template itself (as you pass in the campaign object in the
context).

I'll probably "borrow" some ideas from your code.

One thing that will be interesting to see is whether django-mailer,
when a little further along, can support exactly your use case. I
certainly intend it to do so.

James

Jökull Auðunsson

unread,
Aug 9, 2007, 6:04:39 AM8/9/07
to django...@googlegroups.com
The preview is indeed as you say - if preview is filled the save functionality is short-circuited and a single mail is sent to that address.
Feel free to use whatever part of the code you can - it's in the public domain.

As you noted my architecture is tied to the Email model which is coupled with a newforms signup widget, collecting addresses. It has one custom method: a subscribe toggle for opting in/out of the list.

I'm quite happy with what I have for my use case. I think you are on the right track for a beefier app that scales and has more flexibility. However - usability was a huge concern in my case and as it is in the admin interface it's braindead easy to send emails. It ties into one of the other apps with a dropdown of events to promote. One is selected and off goes the email! Simple and easy but with some trade-offs in flexibility. I would suspect that many users want this ease-of-use and don't mind the tradeoff in flexibility.

What are your thoughts on this tradeoff? Are you primarily concerned with enterprise needs?

Jökull

On 8/9/07, James Tauber < jta...@jtauber.com> wrote:

James Tauber

unread,
Aug 9, 2007, 6:19:13 AM8/9/07
to django...@googlegroups.com

Well, I want to make sure it is possible to build a solution as easy
to use as yours on top of django-mailer if that's all the
functionality someone needs.

But I do want django-mailer to be general purpose enough that it can
be used for large scale mail outs.

A layered approach, along with suitable defaults, means we should be
able to get the best of both worlds in terms of simplicity of
implementing the simple cases and extensibility for the complex cases.


James

Reply all
Reply to author
Forward
0 new messages