Skip to main content

Django models and views for a WordPress database (Django 1.11 or later).

Project description

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

Forked from https://github.com/jcarbaugh/django-wordpress/ to add Django 2 support.

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-py3

Add to INSTALLED_APPS in settings.py:

'wordpress'

Include the following in urls.py:

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

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

the-real-django-wordpress-py3-0.12.1.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

the_real_django_wordpress_py3-0.12.1-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file the-real-django-wordpress-py3-0.12.1.tar.gz.

File metadata

File hashes

Hashes for the-real-django-wordpress-py3-0.12.1.tar.gz
Algorithm Hash digest
SHA256 95c7e798c1992efaeca40437524828eca4dba7a132d7accfb7cb79acd1230797
MD5 2c085bfd1c486f5af8a5d7ec5840bf88
BLAKE2b-256 46881da62840e219398ef5cd41747b9fa4c42d6d7c01e3e213f4609f6c2af7b9

See more details on using hashes here.

File details

Details for the file the_real_django_wordpress_py3-0.12.1-py3-none-any.whl.

File metadata

File hashes

Hashes for the_real_django_wordpress_py3-0.12.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c5c01b4bc946f3103975d7c5485884a8ab4441764bae293366c7e0fd6d4d1dbe
MD5 22630eea781735e08dce679805c4ba2f
BLAKE2b-256 01b9f1781e7586176d16c361fb0457f51669083c5c8994f8ef6b7808aac1d923

See more details on using hashes here.

Supported by

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