Django

Code

Ticket #7589 (closed: fixed)

Opened 5 months ago

Last modified 4 months ago

gis: Modifications to Django management commands to support creation of spatial tables.

Reported by: jbronn Assigned to: nobody
Milestone: 1.0 beta Component: Core framework
Version: SVN Keywords: gis syncdb sql
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

This patch contains the following changes that enable the Django management commands to construct spatial SQL for PostGIS:

1. The addition of the _post_create_sql hook. If a custom field has this function it will be called and its output will precede any other SQL generated by sql.custom_sql_for_model. This works well, but I'm of course open to changes in the function name and/or the possibility of a post_table_create signal or something (doing after post_syncdb will not work).

2. Although not required for GeoDjango having custom_sql_for_model take the style object as a parameter allows for colorizing the generated spatial SQL -- the sqlcustom and syncdb commands are modified to pass in their style object to custom_sql_for_model.

Attachments

gis_post_create_sql.diff (3.1 kB) - added by jbronn on 07/01/08 13:20:48.
Modification of Django management commands to support GeoDjango

Change History

07/01/08 13:20:48 changed by jbronn

  • attachment gis_post_create_sql.diff added.

Modification of Django management commands to support GeoDjango

07/29/08 00:53:44 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [8133]) Fixed #7589 -- Added a way for post-table-creation SQL modifications to be done for custom fields (needed by geo-django, but useful in other situations, too).

Patch from Justin Bronn.

07/29/08 00:55:03 changed by mtredinnick

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

Since field classes aren't going to have their namespace populated by general user code, I removed the leading underscore from your method. It's now just post_create_sql(). I also made a slight tweak to the way you checked for fields declared directly on the object that looks equivalent to what you were attempting, but just double-check I haven't missed something.


Add/Change #7589 (gis: Modifications to Django management commands to support creation of spatial tables.)




Change Properties
Action