Skip to content

Commit

Permalink
Added note about using PublishMeta.publish_reverse_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsensible committed Nov 22, 2012
1 parent 2f8012e commit a573ed4
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
=======
Expand Down

0 comments on commit a573ed4

Please sign in to comment.