On Tue, Mar 1, 2011 at 11:55 AM, Marc Aymerich <glicer...@gmail.com> wrote: > Hi!, > I have a model class like this one: > > class Domain(models.Model): > active = models.BooleanField() > root = models.CharField(max_length=6) > > now given a Domain instance I need to know if it meets with an > expresion like this one: > > active=True and (root='com' or root='net') > > one way to do that is get all domains that meets the expresion > (formated as queryset) and check if the object is one of them. > But maybe there is a more direct way to check it? >
Maybe the answer could be convert the object to dict and do an evalutaion like this: o_dict = object.__dict__ o_dict['active'] == True and (o_dict['root']=='com' or o_dict['root']=='net') but this expresión should be inserted by a user via web form, so I'm wondering how this could be more intuitive for the end user? -- Marc -- 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 django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.