Never mind. My error was elsewhere. A little putzing around led me to
realize that you can't put db_index=True into a geometry field of any sort
in PostGIS backend.
On Sat, Dec 3, 2011 at 11:25 AM, Jeff Heard wrote:
> I have a custom field type that I defined, and now I can't do a syncdb.
> The relevant bits of the type are
>
> class PyMongoField(models.CharField):
>__metaclass__ = models.SubFieldBase
>
>...
>def db_type(self, connection):
> return 'varchar(64)'
>...
>
> But I just get this when I do reset or syncdb on an app with a model that
> uses that field type. Any clue?
>
> Traceback (most recent call last):
> File "manage.py", line 14, in
> execute_manager(settings)
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 438, in execute_manager
> utility.execute()
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/core/management/__init__.py",
> line 379, in execute
> self.fetch_command(subcommand).run_from_argv(self.argv)
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/core/management/base.py",
> line 191, in run_from_argv
> self.execute(*args, **options.__dict__)
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/core/management/base.py",
> line 220, in execute
> output = self.handle(*args, **options)
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/core/management/base.py",
> line 286, in handle
> app_output = self.handle_app(app, **options)
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/core/management/commands/reset.py",
> line 35, in handle_app
> sql_list = sql_reset(app, self.style, connection)
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/core/management/sql.py",
> line 107, in sql_reset
> return sql_delete(app, style, connection) + sql_all(app, style,
> connection)
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/core/management/sql.py",
> line 146, in sql_all
> return sql_create(app, style, connection) + sql_custom(app, style,
> connection) + sql_indexes(app, style, connection)
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/core/management/sql.py",
> line 141, in sql_indexes
> output.extend(connection.creation.sql_indexes_for_model(model, style))
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/db/backends/creation.py",
> line 250, in sql_indexes_for_model
> output.extend(self.sql_indexes_for_field(model, f, style))
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/creation.py",
> line 12, in sql_indexes_for_field
> output = super(PostGISCreation, self).sql_indexes_for_field(model, f,
> style)
> File
> "/opt/data/ga/jeff/lib/python2.7/site-packages/django/db/backends/postgresql/creation.py",
> line 68, in sql_indexes_for_field
> if db_type.startswith('varchar'):
> AttributeError: 'NoneType' object has no attribute 'startswith'
>
>
--
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
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.