These are some beautiful solutions! I completely forgot that I am programming in Python and
-- have all the convenience I want at my fingertips.
Your solution worked like a charm, Javier!
Thank you both.
-Bryan
On Friday, April 10, 2015 at 11:39:47 AM UTC-5, Bryan Arguello wrote:
On Friday, April 10, 2015 at 11:39:47 AM UTC-5, Bryan Arguello wrote:
This small example captures what I am actually trying to do in my application.
list = MyObject.objects.filter(field1 = entries1, field2 = entries2)
I want the query to just ignore "field2 = entries2" if entries2 is empty. Or if entries1 is empty, I want it to ignore "field1 = entries1".
One thing I could do is just use logic to check whether entries1 or entries 2 is empty and create queries for each of the cases,
but my actual application has much more than two fields to check.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9bebae84-3d7e-4846-ab85-b41833770a94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment