On Mar 12, 12:42 pm, Henry A <[email protected]> wrote:
> Hi,
>
> For a client, I've got the following (simplified) models:
>
> class Document (models.Model):
> file = models.FileField()
>
> class Publication (models.Model):
> title = models.CharField()
> ...
> documents = models.ManyToManyField(Document)
>
Do you need a ManyToManyField here? I.E. can a document be in more
than one Publication? I suspect you actually want:
class Document (models.Model):
file = models.FileField()
publication = models.ForeignKey('Publication')
class Publication (models.Model):
title = models.CharField()
Then you can use inline admin forms:
http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects
In 1.2 there is now a nifty jQuery interface so you can keep adding
documents.
Hope that helps
Peter
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.