#7589 closed (fixed)
gis: Modifications to Django management commands to support creation of spatial tables.
Reported by: | jbronn | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | gis syncdb sql | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This patch contains the following changes that enable the Django management commands to construct spatial SQL for PostGIS:
- 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 bysql.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 afterpost_syncdb
will not work).
- Although not required for GeoDjango having
custom_sql_for_model
take the style object as a parameter allows for colorizing the generated spatial SQL -- thesqlcustom
andsyncdb
commands are modified to pass in their style object tocustom_sql_for_model
.
Attachments (1)
Change History (4)
by , 16 years ago
Attachment: | gis_post_create_sql.diff added |
---|
comment:1 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 16 years ago
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.
Note:
See TracTickets
for help on using tickets.
Modification of Django management commands to support GeoDjango