Though I am not conversant with the details of the GIS fundas, here is
my observation....their application gave a very good pointer to people
who always wanted to do custom field development. I wouldn't be happy
to see SQL statements be used in the class (even though it gets the
work because I believe there is another place for it in the
management.py or the data_types).
Here is what I did (not complete as yet):
Created a Check class which inherits the Field Class and write all the
attributes or methods here.
Next, in the management.py I make small changes and write the
appropriate SQL statements.
In management.py ....
In _get_sql_model_create(),
...
for f in opts.fields:
if isinstance(f, (models.ForeignKey, models.OneToOneField)):
rel_field = f.rel.get_related_field()
while isinstance(rel_field, (models.ForeignKey,
models.OneToOneField)):
rel_field = rel_field.rel.get_related_field()
data_type = get_rel_data_type(rel_field)
elif isinstance(f,Check):
# Write my SQL statements here.
else:
rel_field = f
data_type = f.get_internal_type()
col_type = data_types[data_type]
if col_type is not None:
# Make the definition (e.g. 'foo VARCHAR(30)') for this
field.
field_output =
[style.SQL_FIELD(backend.quote_name(f.column)),
style.SQL_COLTYPE(col_type % rel_field.__dict__)]
field_output.append(style.SQL_KEYWORD('%sNULL' % (not
f.null and 'NOT ' or '')))
...
Personally, I believe not all cases for custom SQL development require
SQL to be appended (like mine), so is there a necessity for
_post_create_sql() for my project???
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---