# 3 Scenarios for "specific" or "weak" or " any value Specific and tap scenarios True values such as 656 and in Python are controlled by "none". We How do you manage any value scanners from? Imagine the 3 drop down boxes on which we can query the database. My question is similar Here's one, but specific to DGOs The original SQL specific question is here: In my case, the columnman can be of any type As a result the query may appear something like this Can give:
// call for a specific value Select Col1, Col2, Col3 from the table where Col1 = 343, Col2 = 545, Col3 = 656 // Query for the NULL value Select Col1, Col2, from the Col3 table where Col1 = 343, Col2 = 545, Col3 IS NULL // Select the query for any value Col1, Col2, from Col3 table where Col1 = 343, Col2 = 545, Col3 = *
I think you should exclude the Col3
filter like this:
sample = Table.objects.filter (Col1 = 343, Col2 = 545)
Edit: Do you want to add all these cases to a single statement?
I'm not familiar with the finerity of QuerySets in Django to give you one-liner enough, but taking your 3 dropdown boxes a little further ... If you have any 'dropdown' in your dropdown No 'and' any 'is included in addition to the regular list of values? In this way you can choose a query based on parameters. If param3 == 'None': sample = table.objects.filter (Col1 = 343, Col2 = 545, Col3 = None) Elif param3 == 'any': Sample = table. Objects.filter (Col1 = 343, Col2 = 545) Other: sample = table.objects.filter (Col1 = 343, Col2 = 545, Col3 = param3)
Comments
Post a Comment