What kind of additional configuration? One advantage of not specifying the type of the db_index_type field is that you could instantiate an object that encapsulates the configuration.
Zev On Wednesday, October 2, 2013 1:19:31 PM UTC-4, Alex Burgel wrote: > > This is something that I'd also be interested in. For the Google App > Engine backend, you have the ability to create indexes that require more > configuration than just on/off. But I don't think a single additional field > would do the trick for my case. > > Another option would be to open up the Meta class for custom attributes. > There's a thread which discusses this here: > > https://groups.google.com/forum/#!topic/django-developers/JEDJYB41LGI > > The config might look something like this: > > class Article(db.models): > class Meta: > custom_indexes = {'field1': 'hash', 'field2': 'btree'} > field1 = db.IntegerField() > field2 = db.CharField() > > The tradeoff would be that the index would not be specified in the field > description, but it would be close enough. (Currently for the app engine > backend, you specify these in a separate file that the backend looks for.) > > On Monday, September 23, 2013 10:36:56 AM UTC-4, Zev Benjamin wrote: >> >> Hi, >> >> I'd like to be able to specify what kind of index the database should use >> for a particular field. I have a proof of concept branch that works with >> PostgreSQL at https://github.com/zbenjamin/django/compare/index-types, >> but I'd like to solicit opinions on whether there's a better way of doing >> it. The way it works in my branch is that you specify the index type by >> making the Field db_index argument a string containing the name of the >> index type you'd like to use. Specifying db_index=True uses the default >> index type. >> >> Example usage: >> >> class IndexTest(models.Model): >> unindexed = models.IntegerField(db_index=False) >> default_indexed = models.IntegerField(db_index=True) >> btree_indexed = models.IntegerField(db_index="btree") >> hash_indexed = models.IntegerField(db_index="hash") >> >> >> >> Zev >> > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/dfdaaf76-cf9b-477d-9002-1fde2173e0b2%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
