On 10/23/07, Greg <[EMAIL PROTECTED]> wrote: [snip] > class Collection(models.Model): > > THE_MATERIAL = ( > ('1', 'Paper'),('2', 'Plastic'),('3', 'Other'), > ) > > material = models.CharField(max_length=50, choices=THE_MATERIAL) > > /////////////////// > > However, now I want to be able to do a query that returns all of the > values in THE_MATERIAL (even if it's not being used by any > collection). How would the query be setup to do this?
Well, you can't set up a query for something that isn't in the database. But the values are right there in THE_MATERIAL. If you want a list of just the text values, stripping away the numeric choices, some simple Python: material_list = [y for x,y in THE_MATERIAL] would do it. Karen --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---