It's always bugged me a little that choice lookups are based on the raw value.
Example for discussion: CHOICES = ( (1, 'parrot'), (2, 'argument'), ) class Profile(models.Model): user = FK(User) favorite_skit = IntegerField(choices=CHOICES) In staticly-typed languages, and paraphrasing a bit, lookups like this are based on enums. Querying for parrot lovers: Profile.objects.filter(favorite_skit=1) which is kind of unreadable. It'd be nice if we could do this: Profile.objects.filter(favorite_skit__display='parrot') That is, introduce a new __display lookup type which accepts a string and tries to get the raw value based on the choices kwarg on that field. (A little utility could be added for choice reversal: REV_CHOICES = dict((v,k) for (k,v) in CHOICES) Profile.objects.filter(favorite_skit=REV_CHOICES['parrot']) but that's a sideline; you still have to do the import and it's a bit verbose, especially if you consider likely namespace collisions. ) The only complaint I can see for this is that some people may be using different raw values to map to the same display value, but the new __display lookup type would just be another way; querying with raw values would still work. Thoughts? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers?hl=en -~----------~----~----~----~------~----~------~--~---