>I am a participant in the Summer of Code 2007.

Welcome to the development list!

>For my project,all that I have to do is actually append the sql
>statements for the table (containing the check statements) when syncdb
>is called. My problem is a typical one that "There is more than one
>way of doing it"

We encountered a similar problem on the GIS branch.  Specifically, the
OpenGIS specification requires that compliant spatial databases add
geometry columns by calling the stored procedure AddGeometryColumn()
after the table definition.

The way we solved it was a bit different from your proposals.  We
patched the management.py function get_custom_sql_for_model() to look
for a function on the field called "_post_create_sql."  In our Field
subclass, GeometryField, we define a _post_create_sql method that
returns the needed SQL (a string).  The field-generated SQL hitches a
ride on the output of the initial SQL data function that is already
called anyway.

Patch to management.py is the first shown:
http://code.djangoproject.com/changeset/4674

Look at GeometryField to see how _post_create_sql() works:
http://code.djangoproject.com/browser/django/branches/gis/django/contrib/gis/db/models/fields/__init__.py

Regards,
-Justin


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to