Tuesday, March 1, 2011

eval if an object meets with a queryset.

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?

Thanks!
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment