Hi, I'm having trouble. My model has publications and authors, and the
order of authors matters and should be specified by users of the admin
interface. To implement the ordered list, I made an intermediary model
called "PubAuthor", where the user has to enter a number for each
author to specify the ordering. I inline this into the Pub admin view
with foreignkey.

However, after I have SAVED a pub, I cannot change the Person field of
its PubAuthors from the inlined page on the Pub admin page! Here's a
screenshot: 
http://code.djangoproject.com/attachment/ticket/6118/badorderedmanytomany.png

Can anyone suggest a better way to do this? Ideally I wouldn't require
my admin users to manually specify the index of each author in the
right-hand column either.

--------------- models.py: -----------------------

from django.db import models
import datetime

class Person(models.Model):
    first_name = models.CharField(max_length=30)
    last_name = models.CharField(max_length=30)
    homepage_url = models.URLField(blank=True)
    class Admin:
        pass
    def __unicode__(self):
        return self.first_name + ' ' + self.last_name
    def __str__(self):
        return self.first_name + ' ' + self.last_name


class Pub(models.Model):
    title = models.CharField(max_length=200)
    icon = models.ImageField(upload_to='icons', height_field=True,
width_field=True, blank=True)
    pdf_url = models.URLField(verify_exists=True, blank=True)
    class Admin:
        pass
    def __str__(self):
        return self.title


class PubAuthor(models.Model):
    person = models.OneToOneField(Person, core=True)
    author_number = models.IntegerField(core=True, blank=False,
null=False)
    pub = models.ForeignKey(Pub, edit_inline=models.TABULAR,
num_in_admin=5)
    class Admin:
        pass
    def __str__(self):
        return self.person.__str__() + ' ' + str(self.author_number)


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