On Wed, 2006-10-11 at 10:51 -0400, [EMAIL PROTECTED] wrote:
[...]
> On a more general note, is there an accepted way to add fields into
> contrib? I'd like to be able to have Django create tables with geometry
> columns, and using any typecasts I may end with, without the end user
> having to modify the base files. I think this would be useful for folks
> when it's done, but I certainly don't think it belongs in django core.

Not at the moment. There are two problems that need solving here (I've
mentioned this before either on this list or django-dev) and they're
both still on my endless TODO list. I'll get to them one day.

(1) For fields that are Python wrappers over existing database fields,
there is a small change that needs to be made to the model attribute
creation so that the data from the database is passed to the Field
sub-class's constructor for converting into the right type. This change
is relatively simple (about two lines of code).

        An example of this is if you make a field called Sudoku, say,
        but the data is stored as a string of 81 characters in the
        database. After retrieving the data, it would be nice if the
        model attribute was actually a Sudoku class instance, rather
        than a seemingly opaque string.
        
(2) For fields that are new database types, it is slightly more fiddly.
We need a way to have them created correctly in the database (possibly
also adding introspection, on the "give an inch and somebody is going to
complain about the rest of the mile being missing" principle). We
possibly need a retrieval mapping function -- imagine if we didn't have
a native date field; how might we implement it as a third-party class --
or possibly just hand off the rest of the work to case (1).

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to