On Fri, Sep 01, 2006 at 10:21:38AM -0700, mthorley wrote: > Table creation is handled by core.management. In it, a lookup is > preformed where it loads the dict DATA_TYPES (or something like that) > from db.backends.<yourdb>.creation. Then it attempts a key matching the > field class name of each field in your model. So in order to create > your own fields, whether you subclass an existing one or not, you must > either overwrite the class name, or add your fieldtype to the list.
This thread has peaked my interest so I did some code digging. I was thinking that overriding the class name didn't seem like a smart choice. I thought it would be nice if the creation code would check the parent class's name if it couldn't find the current class name in DATA_TYPES. Upon inspection of the code I found it was calling get_internal_type() for each field. If you look in db/models/fields/__init__.py you'll find that this is used in EmailField which subclasses CharField. class EmailField(CharField): ... def get_internal_type(self): return "CharField" Now I'll have to try creating some custom fields myself. :) Nate --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---