Hi,

> the  ManyToManyField creates additional refdb_reference_authors table
> in database with columns  "id", "reference_id", "author_id". now for
> every Reference I can assign one or more Author with a link keeping in
> this table. but additionally I'd like to keep the order of Author for
> every reference (it is important for scientific publications),

What you want to do is the following. Instead of using a ManyToManyField, 
create an intermediate table:

class AuthorLoc(models.Model):
   author=models.ForeignKey(Author)
   position=models.IntegerField()
   reference=models.ForeignKey(Reference,edit_inline=True)

   class Meta:
     ordering=(('position'))

Then when you want to search authors or references you can ...

# Get all authors for ref with id ref_id
as=Author.objects.filter(authorloc__reference__id__exact=ref_id).distinct()
# Get all refs for author with id author_id
Reference.objects.filter(authorloc__author__id__exact=author_id).distinct()
# Get all papers author with author_id has first-authored
as.filter(authorloc__reference__position__exact=1)
# etc...

Hope this helps.

Sincerely,
Toby Dylan Hocking
http://www.ocf.berkeley.edu/~tdhock

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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