> The error message is telling you exactly what the problem is here. It
> wants Position to have a ForeignKey to Member. When you read that and
> look at your models and see that you have Member having a ForeignKey to
> Position, you have to then think that perhaps that means you've got the
> inline direction going the wrong way. There's nothing in the
> documentation to say it's a bidirectional option. ForeignKey is a
> many-to-one option: many members for one position. Inline editing exists
> so that you can edit these "many" members inline with the single
> position that they all relate to. It isn't needed for the other
> direction.
>
> You don't seem to have tried the obvious solution here: include
> "position" in the list of fields for Member's admin. That will do
> exactly what you're after.
>
> Regards,
> Malcolm

ok then, thanks for the help.

However, I didn't see your response till just now (I sent the initial
question via gmail and expected that it wouldn't automatically add
repsonses to that conversation in gmail, but it seems it doesn't....)

Anyways, I spent some time after work today playing around with it and
reading django model documentation and trying to figure it all out,
and the following works

class Committee(models.Model):
        year = models.IntegerField()
        members = models.ManyToManyField('Member')

class Member(models.Model):
        name = models.CharField(max_length=50)
        degree = models.CharField(max_length = 50)
        desc = models.TextField()
        position = models.ManyToManyField('Position')

class Position(models.Model):
        year = models.IntegerField()
        position_type = models.ForeignKey('PositionType')

class PositionType(models.Model):
        title = models.CharField(max_length=50)
        desc = models.TextField()

Even with default settings for admin interface :)

Only thing I need now is the "add another" button for the relationship
fields to show up even when there isn't already an instance of the
object in question in the database.

I say this, because, let's say for example the admin page for
committee.
If there is already at least one member in the database, then the
control for the members field will have this nice little green '+'
that allows me to create more members, however if there is no members
already in the database, it isn't there.....
(same with foreignKey fields)

for further illustration, screenshots :)
with no objects : http://delfick.test.googlepages.com/noObjects.png
with at least one object : http://delfick.test.googlepages.com/moreThanOne.png

Thankyou

.....

Regards
Stephen
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to