Adding ponies to Plone's horsepower

A small building block to integrate your Django application with your favorite CMS

PoniesIf you ever thought that Plone's massive horsepower was missing the agility and parking ease that only a pony can bring, then you might have found yourself in my same situation.

Use case

If for whatever reason you need to be able to fetch some data that your Django application holds from Plone, you have two choices:

  1. Use webservices
  2. Read it from the database

If you're lazy like me, you'll go for option #2. If you go for #2, you again have two choices (it's a binary tree of choices!):

  1. Use sqlalchemy, which has some good integration with Zope's transaction manager, among other goodies
  2. Try to integrate Django's transaction management with Zope's transaction manager, so you can use the Django models and avoid to remap all the objects in SQLAlchemy too

If you're lazy like me, it's a tough choice, as both seem to involve writing actual code (oh my!). But you might be luckier than me, as I did take route #2 again, and came out with collective.django.

What it does

Very few. It just links the Django transaction management with Zope's transaction manager, so that if you commit the Zope transaction, it will be committed on Django too, and if it will be aborted or rollbacked, the same will happen on the Django side.

This allows you to safely do things like

from Products.Five import BrowserView
from myapp.models import UselessThing

class MyView(BrowserView):
    def boring_things(self):
        for useless in UselessThing.objects.all():

But also writing Django models from Plone and the like. All you have to do is read the README and try it out!


The code is quite in ana alpha stage, and so far hasn't been extensively tested, so don't drop it into any production site without doing some stress test first. If you are curious about implementation details, you can find some notes within the docs/INTERNALS.rst file.

Coming soon

Among the ideas we have to further develop this useful piece of crap code, there are:

  • A PASPlugin to use Django's user backend within Plone (effectively unifying logins)
  • A way to "embed" a Django application seamlessly within Plone by using a placeholder content from which to "slip" into Django

Share this on

Share |

On same topics


comments powered by Disqus