Imagine:

from django.db import models

class Mtmfield(models.Model):
    afield = models.TextField()

class Place(models.Model):
    somefield = models.ManyToManyField(Mtmfield,
related_name='a_name_that_cant_have_conflicts')

    class Meta:
        abstract = True

class Restaurant(Place):
    someotherfield = models.TextField()

class Bar(Place):
    somethirdfield = models.TextField()


Running a manage.py syncdb throws:

Creating table inheritance_mtmfield
Creating table inheritance_bar
Creating table inheritance_restaurant
Traceback (most recent call last):
  File "./manage.py", line 11, in <module>
    execute_manager(settings)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/__init__.py", line 272, in execute_manager
    utility.execute()
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/__init__.py", line 219, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/base.py", line 72, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/base.py", line 86, in execute
    output = self.handle(*args, **options)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/base.py", line 168, in handle
    return self.handle_noargs(**options)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/core/management/commands/syncdb.py", line 91, in handle_noargs
    cursor.execute(statement)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/db/backends/util.py", line 18, in execute
    return self.cursor.execute(sql, params)
  File "/Users/mnewman/Documents/resources/django/queryset-refactor/
django/db/backends/sqlite3/base.py", line 136, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: table "inheritance_bar_somefield" already
exists

This only seems to occur when there is a ManyToManyField in the
abstract base class and there are 2 items that extend that base class.
This does not seem to be a problem when the base class is not
abstract. This also occurs in MySQL.

I would like to open a ticket, but wanted to just make sure that I am
implementing the abstract base classes in the way that they were
designed. I would also like to help out with a patch, but can't even
begin to figure out where the issue is coming from.

Thanks,

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