Skip to main content

Django transaction integration for Plone

Project description

This package allows you to use the Django ORM within Plone.

It takes care to merge Django transaction management within Zope’s own transaction manager.

Basic usage

In order to use this package you must have a setup that looks like the following:

  1. Your settings module must be within buildout’s “adjusted” sys.path. This means it should be importable from within Plone, hence that it should be an egg (either released or more commonly in development). Jacob Kaplan-Moss explains how to do this for a Django buildout.

  2. Your buildout should contain both the Plone parts and the Django parts together, hence the standard Plone buildouts plus the bits you see in Jacob’s tutorial. Make sure that your plone instance has, within its eggs, the project one (shorturls in Jacob’s example) either derived from buildout’s ones or local to the instance.

The second step is to make sure that your Plone instance has a special environment variable that Django needs to know where its settings are. Hence put, under your instance buildout section, something like this:

[buildout]
...
[instance]
recipe = plone.recipe.zope2instance
...
environment-vars =
    DJANGO_SETTINGS_MODULE shorturls.testsettings

Again values are borrowed from Jacob’s post.

Then just add the egg to your buildout, like this:

[buildout]
...
eggs =
    ...
    collective.django

The package itself relies on z3c.autoinclude to load its ZCML when Plone is pulled up. In case this does not work, include a:

<include package="collective.django" />

Within your package ZCML.

And whenever you will import your Django models from Plone, the transaction will be managed by Zope.

Testing

To run the tests, a minimal buildout is included. After checking out the source code, run the following:

$ python bootstrap.py
$ bin/buildout
$ bin/test

And the tests should be ran.

Changelog

1.0 (2014-08-29)

  • fix to work with Django 1.6 [vangheem]

0.2 (2011-09-28)

  • fix bad release

0.1 (2011-09-16)

  • Django 1.3 compatibility and initialization fixes [vangheem]

  • Initial public version [shywolf9982]

Contributors

A big thanks to the developers of zope.sqlalchemy for providing a good “template”.

Initial developement supported by Abstract Open Solutions

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

collective.django-1.0.zip (22.2 kB view details)

Uploaded Source

File details

Details for the file collective.django-1.0.zip.

File metadata

File hashes

Hashes for collective.django-1.0.zip
Algorithm Hash digest
SHA256 f3af0697e726d56846eb400b6b83af578c507937fad4d0f862915230cd1a4716
MD5 20cb83d2ad850e87afcdd8924462ec6c
BLAKE2b-256 189a7b714dd7c779842bdb6c68916989a32fcac20748b78787e1bc8ecd13919f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page