Hi, for me it has a big WTF factor. Automatically created tables according to field.
As DirectoryField I would suppose behaviour like SET or ENUM fields in MySQL. I hope there are equivalents in other DB storages. Implementation of this types I would appreciate in Django ORM. This doesn't need to be even new field. It will be sufficient to have implemented those use cases for present field types which gets default values as dictionary or tuple of tuples. - validating: no other values except set in defaults are valid - unique values in SETs - support for binary representation of values and binary matching in ORM queries Vaclav On 17 led, 00:02, Mihail Lukin <mihail.lu...@googlemail.com> wrote: > Hi, Community > > Sometimes an application model include a lot of fields which are just > dictionary values. Example: > > class HDD(models.Model): > form_factor = models.ForeignKey(HDDFF) > capacity = models.ForeignKey(HDDCap) > interface = models.ForeignKey(HDDIntf) > ... > > and so on, where HDDFF, HDDCap and HDDIntf are similar classes. > Abstract class with only one field "name" may be used, so that this > classes could be defined like this: > > class HDDFF(DictModel): pass > > but it is not as good as something like this: > > class HDD(models.Model): > form_factor = models.DictionaryField() > capacity = models.DictionaryField() > interface = models.DictionaryField() > > Database tables "hdd_form_factor_dict", "hdd_capacity_dict" and so on > could be created automatically, just like it is done by > ManyToManyField. > > What do you think about that?
-- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.