Hello Peter,

I use Postgres and have success creating a manytomany table.  See:

http://dpaste.com/103824/

Ana

On Dec 30, 10:29 am, Peter <[email protected]> wrote:
> I have two models: Person and Telephone. A person can have many
> telephones but a telephone belongs to at most one person. The models
> are:
>
> class Person(models.Model):
>     name = models.CharField(max_length=50)
>
>     def __unicode__(self):
>         return self.name
>
> class Telephone(models.Model):
>     phone_number = models.IntegerField()
>     phone_type = models.CharField(max_length=50, blank=False)
>     owner = models.ForeignKey(Person, blank=True, null=True)
>     ordering = ['+phone_number',]
>
>     def __unicode__(self):
>         return unicode(self.phone_number)
>
> In admin.py I have:
>
> class TelephoneInline(admin.TabularInline):
>     model = Telephone
>
> class PersonAdmin(admin.ModelAdmin):
>     inlines = [TelephoneInline,]
>     fk_name='owner'
> admin.site.register(Person, PersonAdmin)
>
> Using PostgreSQL this allows me a single phone number for a person. I
> can chnage and delete the number. However if I add more than one phone
> number I cannot change or delete numbers.
>
> Changing from PostgreSQL to MySQL this issue disappears.
>
> There is no useful error information I can access (just the default
> ValidationError). Has anyone any idea what this might be?
>
> -- 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to