Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
Your right... I can't testing now.


2013/10/9 Hélio Miranda 

> gives error:
> 'BaseList' object has no attribute 'values'
>
> The query has to be the same as I stated it works:
> *
> Player.objects.filter(country__in=Country.objects.filter(nationality__in=Nationality.objects.filter(name='Espanhola')))
> *
>
> --
> 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+unsubscr...@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/7a4cf4fe-0c5a-40ff-92fc-60c51164239f%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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+unsubscr...@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/CA%2BX6QOWHTn7xc%3DY11b8%2BU5sTP%3DCu03AhSvGM5F3R66wxO8AWUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
gives error:
'BaseList' object has no attribute 'values'

The query has to be the same as I stated it works:
*
Player.objects.filter(country__in=Country.objects.filter(nationality__in=Nationality.objects.filter(name='Espanhola')))
*

-- 
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+unsubscr...@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/7a4cf4fe-0c5a-40ff-92fc-60c51164239f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
try this solution
http://plnkr.co/edit/cyM6AmZcyFVUU6soFKhB


2013/10/9 Denis Chernoshchekov 

> ok, i understand, i minute.
>
>
> 2013/10/9 Denis Chernoshchekov 
>
>> *fld_name = 'nationality_in' *must be with double '_'* **fld_name =
>> 'nationality__in'*
>>
>>
>> 2013/10/9 Denis Chernoshchekov 
>>
>>> Sorry, i don't understand you... You can control all your values for all
>>> fields, you can generate dict which you like.
>>>
>>>
>>> 2013/10/9 Hélio Miranda 
>>>
 I put that work, I wanted to know was how to put in the code, because
 you can not do the same to position

 --
 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+unsubscr...@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/7ab55030-ef63-42de-b4b4-cad45b7c287c%40googlegroups.com
 .

 For more options, visit https://groups.google.com/groups/opt_out.

>>>
>>>
>>
>

-- 
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+unsubscr...@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/CA%2BX6QOULQK0n5mgAsyDGwFbYrJqtVYxZtSUZ4wm_fjK6r_7tHg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
ok, i understand, i minute.


2013/10/9 Denis Chernoshchekov 

> *fld_name = 'nationality_in' *must be with double '_'* **fld_name =
> 'nationality__in'*
>
>
> 2013/10/9 Denis Chernoshchekov 
>
>> Sorry, i don't understand you... You can control all your values for all
>> fields, you can generate dict which you like.
>>
>>
>> 2013/10/9 Hélio Miranda 
>>
>>> I put that work, I wanted to know was how to put in the code, because
>>> you can not do the same to position
>>>
>>> --
>>> 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+unsubscr...@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/7ab55030-ef63-42de-b4b4-cad45b7c287c%40googlegroups.com
>>> .
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>
>>
>

-- 
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+unsubscr...@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/CA%2BX6QOUf7Ck0Y9ptjn_FaJLEaPzPdmas01CRPW_QPNVg39%2BD8A%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
*fld_name = 'nationality_in' *must be with double '_'* **fld_name =
'nationality__in'*


2013/10/9 Denis Chernoshchekov 

> Sorry, i don't understand you... You can control all your values for all
> fields, you can generate dict which you like.
>
>
> 2013/10/9 Hélio Miranda 
>
>> I put that work, I wanted to know was how to put in the code, because you
>> can not do the same to position
>>
>> --
>> 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+unsubscr...@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/7ab55030-ef63-42de-b4b4-cad45b7c287c%40googlegroups.com
>> .
>>
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
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+unsubscr...@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/CA%2BX6QOW%3D_kZw7BWo6TWL3fzk92U89i7rqkw8yZ3jg-mxRuwKsQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
Sorry, i don't understand you... You can control all your values for all
fields, you can generate dict which you like.


2013/10/9 Hélio Miranda 

> I put that work, I wanted to know was how to put in the code, because you
> can not do the same to position
>
> --
> 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+unsubscr...@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/7ab55030-ef63-42de-b4b4-cad45b7c287c%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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+unsubscr...@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/CA%2BX6QOVmFDZ5kexgJgiec9GeLazOcA7fgAVdp-Ybv%3DfUmgchig%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
was trying something like this:
*if fld_name == 'nationality':*
*fld_name = 'nationality_in'*
*value = 
Player.objects.filter(country__in=Country.objects.filter(nationality__in=Nationality.objects.filter(name=value)))
*

But it does not work

-- 
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+unsubscr...@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/360f22d0-de14-4ec8-b9d4-3c4079f6ee39%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
I put that work, I wanted to know was how to put in the code, because you 
can not do the same to position

-- 
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+unsubscr...@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/7ab55030-ef63-42de-b4b4-cad45b7c287c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
Try this - *Player.objects.filter(country__in=**
Nationality.objects.filter(name='Espanhola').distinct('country').values('country'))
*


2013/10/9 Hélio Miranda 

> yes, that was it ...
> Just one more thing, if I would like to create the nationality of the
> player, so that the filter is:
> *
> Player.objects.filter(country__in=Country.objects.filter(nationality__in=Nationality.objects.filter(name='Espanhola')))
> *
> *
> *
> where only the step nationality, as I do, not only gives an if?
>
> --
> 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+unsubscr...@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/c8a6-6f7f-4603-9834-c94e426208e0%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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+unsubscr...@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/CA%2BX6QOVx4ad26UpgA6YEPvQy%3DjNiNfQADgaAPW%2B%2BBNe4xBtexQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
yes, that was it ...
Just one more thing, if I would like to create the nationality of the 
player, so that the filter is:
*
Player.objects.filter(country__in=Country.objects.filter(nationality__in=Nationality.objects.filter(name='Espanhola')))
*
*
*
where only the step nationality, as I do, not only gives an if?

-- 
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+unsubscr...@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/c8a6-6f7f-4603-9834-c94e426208e0%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
See, maybe like this?
http://plnkr.co/edit/cyM6AmZcyFVUU6soFKhB


2013/10/9 Hélio Miranda 

> I have code like this:
> http://plnkr.co/edit/L1ByIyFyaEdgwrfVU7Jr
>
> Just do not know how to put this part in the code ...
> Where do I put this part?
>
> --
> 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+unsubscr...@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/5b896e03-fa40-4dbd-8075-8cad2ac954a8%40googlegroups.com
> .
>
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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+unsubscr...@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/CA%2BX6QOXpZaaWf89JobtYMvZCD9JvJdyVtrDNaR2VtWZZK4A5Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
I have code like this:
http://plnkr.co/edit/L1ByIyFyaEdgwrfVU7Jr

Just do not know how to put this part in the code ...
Where do I put this part?

-- 
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+unsubscr...@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/5b896e03-fa40-4dbd-8075-8cad2ac954a8%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
For position you may have dict like - **{' position__in ':
Position.objects. filter(name=positionpost) }
9 жовт. 2013 11:45, користувач "Hélio Miranda"  написав:

> hi, thanks that helped a lot.
> But I have a problem which is, for example when I do a filter by position,
> is not direct as other fields like name or surname. For the position I have
> to type this:
> *
> Player.objects.filter(position__in=Position.objects.filter(name=positionpost))
> *
> How can I implement this in code?
> Can you help me?
>
> --
> 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+unsubscr...@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/f2e7c115-275d-4fab-9dab-f5c0a10c9544%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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+unsubscr...@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/CA%2BX6QOVRDjrjU3CrDZxsREHYMt5MzuJ5k3_14WPMSycO-fnKMg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
hi, thanks that helped a lot.
But I have a problem which is, for example when I do a filter by position, 
is not direct as other fields like name or surname. For the position I have 
to type this:
*
Player.objects.filter(position__in=Position.objects.filter(name=positionpost))
*
How can I implement this in code?
Can you help me?

-- 
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+unsubscr...@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/f2e7c115-275d-4fab-9dab-f5c0a10c9544%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Denis Chernoshchekov
You can pass filter params like a dict -
Player.objects.filter(**your_dict), so you need only prepare your dict from
POST.
8 жовт. 2013 17:42, користувач "Hélio Miranda"  написав:

> Hi
> Here I am having a problem which is as follows:
> I 'm getting parameters via post to make querys depending on paramtros I
> are passed ... doing gender filters.
> So I'm doing well
> *def filter(request):*
> *if request.method == 'POST':*
> *namepost = request.POST.get('name')*
> *surnamepost = request.POST.get('surname')*
> *
> *
> *if namepost != None and surnamepost != None:*
> *result = [a.get_json() for a in
> Player.objects.filter((Q(name=namepost) & Q(surname=surnamepost)))]*
> *   elif namepost != None and surnamepost == None:*
> *result = [a.get_json() for a in
> Player.objects.filter(name=namepost)]*
> **
> *data = {"meta": {"total_count":len(result)}, "objects": result}*
> *aa = json.dumps(data)*
> *return HttpResponse(aa, content_type='application/json')*
>
> Is working properly , the problem is :
> If it were only these two parameters , there was no problem , was to
> complete the rest of the hypotheses ... the problem is that I can have up
> to 10 parameters passed by post to the filters , and I never know which are
> passed , can be 1 , 2, 4, ... as the user makes the filter ...
>
> But doing so would take a lot of ifs , it would have many chances ...
> is there any way I can do this another way ?
> Someone can help me ?
>
> --
> 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+unsubscr...@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/fc851085-d5bb-4567-b830-d25cdd66e499%40googlegroups.com
> .
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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+unsubscr...@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/CA%2BX6QOXTgDCfXiB_CsqgRjg_V5ngho5gk%3DoZEfP8WhpwfcB2Kg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-09 Thread Hélio Miranda
I was testing you sent me, but it is giving me error ... is giving this 
error: *expected string or buffer*

-- 
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+unsubscr...@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/08b4c60e-585e-483c-b520-739a1efa615a%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: Query parameters for receiving post

2013-10-08 Thread Ramiro Morales
On Tue, Oct 8, 2013 at 11:42 AM, Hélio Miranda  wrote:
>
> Hi
> Here I am having a problem which is as follows:
> I 'm getting parameters via post to make querys depending on paramtros I are 
> passed ... doing gender filters.
> So I'm doing well
> def filter(request):
> if request.method == 'POST':
> namepost = request.POST.get('name')
> surnamepost = request.POST.get('surname')
>
> if namepost != None and surnamepost != None:
> result = [a.get_json() for a in 
> Player.objects.filter((Q(name=namepost) & Q(surname=surnamepost)))]
>elif namepost != None and surnamepost == None:
> result = [a.get_json() for a in 
> Player.objects.filter(name=namepost)]
>
> data = {"meta": {"total_count":len(result)}, "objects": result}
> aa = json.dumps(data)
> return HttpResponse(aa, content_type='application/json')
>
> Is working properly , the problem is :
> If it were only these two parameters , there was no problem , was to complete 
> the rest of the hypotheses ... the problem is that I can have up to 10 
> parameters passed by post to the filters , and I never know which are passed 
> , can be 1 , 2, 4, ... as the user makes the filter ...
>
> But doing so would take a lot of ifs , it would have many chances ...
> is there any way I can do this another way ?
> Someone can help me ?

I can't thes this now but hopefully something similar to thois could
be of help: https://dpaste.de/FTnt

-- 
Ramiro Morales
@ramiromorales

-- 
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+unsubscr...@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/CAO7PdF80K5SxRAKXVgi55JtjuRRcwNq58Df-DZXZrZeuJSBRdg%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.