Skip to main content

Models and views for reading a WordPress database. Compatible with WordPress version 3.5+.

django-wordpress is a project of ISL and the Sunlight Foundation.

Features

Read-only models to protect your content

This package is designed to be read-only. Writing is enabled by adding WP_READ_ONLY = False to settings.py. None of the WordPress specific logic is included while writing to the database so there is a good chance you will break your WordPress install if you enable writing.

WordPress table prefix

The default table prefix is wp. To change the table prefix, add WP_TABLE_PREFIX = 'yourprefix' to settings.py.

Multiple database support

Added the ability to specify which database the WordPress content is coming from. Set it using the WP_DATABASE setting. Defaults to “default”.

Database routers need be set to:

DATABASE_ROUTERS = ['wordpress.router.WordpressRouter']

Default templates

Default templates are provided only for development purposes so you can see content in your browser! Please override these with customized templates for your application.

Export Management Commands

  • wpexport Dump published posts in WXR format.

  • wpexportauthors Export authors as CSV.

Working With WordPress Models

Ten most recent published posts:

Posts.objects.published()[:10]

Posts tagged wordpress:

Posts.objects.term("wordpress")

Post attachments:

for attachment in post.attachments():
    pass

Post tags:

post.tags()

Installation

pip install the-real-django-wordpress

Add to INSTALLED_APPS in settings.py:

'wordpress'

Include the following in urls.py:

url(r'^path/to/blog/', include('wordpress.urls')),

Release files for the-real-django-wordpress 0.11.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for the-real-django-wordpress 0.11.0
File Size Uploaded
the-real-django-wordpress-0.11.0.tar.gz 15.2 kB Details

Release files / the-real-django-wordpress-0.11.0.tar.gz

Download URL the-real-django-wordpress-0.11.0.tar.gz
Size 15.2 kB
Tags Source
SHA-256 checksum
How to use checksums
991cc22b5f36e2562bf017e48c11cae32d2fdd6025a2402853298319fc2e8195
BLAKE2b-256 checksum
How to use checksums
d98da59a146c4b2d97b0d400ea90dcffa4d4e1b97a403127ea6c9eb189bde91f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.11.0 This release

1 release file

0.10.1

1 release file

0.10.0

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9

1 release file

0.8

1 release file

0.7

1 release file

0.6

1 release file

0.5

1 release file

0.4

1 release file

0.3

1 release file

0.2

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page