From a573ed4e57809aa4c976487c2c9b2b65b7dce42e Mon Sep 17 00:00:00 2001 From: John Montgomery Date: Thu, 22 Nov 2012 11:58:47 +0000 Subject: [PATCH] Added note about using PublishMeta.publish_reverse_fields --- README.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.rst b/README.rst index f3fe442..3636471 100644 --- a/README.rst +++ b/README.rst @@ -106,6 +106,26 @@ The classes ``PublishableStackedInline`` and ``PublishableTabularInline`` are al admin.site.register(MyModel, MyModelAdmin) +You'll also need to add a ``PublishMeta`` field to the parent model, so that it will also publish the child models whenever it is published: + +:: + + from django.db import models + from publish.models import Publishable + + class MyModel(Publishable): # extends from Publishable instead of models.Model + title = models.CharField(max_length=100) + + class Meta(Publish.Meta): # note you should extend from Publish.Meta + ordering = ["title"] + + class PublishMeta(Publishable.PublishMeta): + publish_reverse_fields = ['mychildmodel_set'] # name of reverse relation + + + class MyChild(Publishable): + mymodel = models.ForeignKey(MyModel) + Signals =======