If I use variable names without quotes in "params[]", I get errors
too.
My Python is 2.5. It does not have this string formatting feature.
It's new in 2.6.
On Jul 25, 6:58 am, Necmettin wrote:
> On 25 Temmuz, 02:23, David wrote:
>
> > I used this syntax
>
> > .extra(where=['%s >= %s - %s'],
On 25 Temmuz, 02:23, David wrote:
> I used this syntax
>
> .extra(where=['%s >= %s - %s'], params=['criteria1_metric1',
> 'criteria1_metric2', 'criteria1_value'])
>
> however I got error.
You seem to be using the variables' names as strings:
>>> criteria1_metric1 = 'somevalue'
>>> criteria1_met
Have you tried making manual formatting, i.e.
val1 = 'col1'
val2 = 'col2'
op = '>'
# Python 2.6+ string formatting
.extra(where=["{0} {1} {2}".format(val1, op, val2)])
On Jul 25, 2:28 am, David wrote:
> anybody likes to give me help? thanks so much.
>
> On Jul 24, 4:23 pm, David wrote:
>
> >
anybody likes to give me help? thanks so much.
On Jul 24, 4:23 pm, David wrote:
> I used this syntax
>
> .extra(where=['%s >= %s - %s'], params=['criteria1_metric1',
> 'criteria1_metric2', 'criteria1_value'])
>
> however I got error.
>
> On Jul 24, 4:16 pm, David wrote:
>
>
>
> > Here comes
I used this syntax
.extra(where=['%s >= %s - %s'], params=['criteria1_metric1',
'criteria1_metric2', 'criteria1_value'])
however I got error.
On Jul 24, 4:16 pm, David wrote:
> Here comes a new problem. I do not know which columns' values to use;
> all I know is that they are represented wi
Here comes a new problem. I do not know which columns' values to use;
all I know is that they are represented with variables. These
variables are
col_var_1, condition_operator, col_var_2, manipulation_operator,
constant_value
where:
col_var_1: col1, or col2, or col3, etc
condition_operator: >,
Great. I go to pick up extra() to use.
Thanks Tim.
On Jul 24, 2:33 pm, Tim Chase wrote:
> > Such a transformation is fine. I found that my Django has no F().
> > Checking the Django doc I saw that this new feature is "New in Django
> > Development version".
>
> > So I have to wait for the new
> Such a transformation is fine. I found that my Django has no F().
> Checking the Django doc I saw that this new feature is "New in Django
> Development version".
>
> So I have to wait for the new version? Are there any other ways to
> create such a filter?
>> col1_value >= col2_value * 2
>>
>>
Such a transformation is fine. I found that my Django has no F().
Checking the Django doc I saw that this new feature is "New in Django
Development version".
So I have to wait for the new version? Are there any other ways to
create such a filter?
Any ideas?
Thanks again.
On Jul 24, 2:01 pm,
It seems to me that you have to transform your fields lookup like that :
col1_value >= col2_value * 2
something like col1__gte=F('col2') * 2
Frédéric
2009/7/24 David :
>
> Hello,
>
> Here is a table "myTable" with columns of "col1", "col2", "col3", ...,
> "col5". The types of these columns ar
Hello,
Here is a table "myTable" with columns of "col1", "col2", "col3", ...,
"col5". The types of these columns are all float. Now for two values
from any two columns of these columns, I may need to add, or subtract,
or multiply or divide these two values. With this result, I do a
condition chec
11 matches
Mail list logo