Silvering: if i understood you correctly, it's not doing what you want
FunkyBob
Dr_ST: so, you mean according to the value of a specific field
Dr_ST
yep
FunkyBob
Dr_ST: that look sright
ksoviero has quit
asbjxrn has quit
Dr_ST
not the value, but how much there are with the same value in a field
dAnjou
Silvering: with this app you'd have to install your django app on the same machine that's displaying the website
Silvering
dAnjou : you are right I read too fast...
FunkyBob
how many there are...
ok
moritz_s
FunkyBob: I'm aware of that, but since elmcrest is using plain Q objects, you have to use | or & explicitely
FunkyBob
Dr_ST: so what's the problem?
moritz_s: yes and no
Dr_ST
I don't get the good info
moritz_s
FunkyBob: What do you mean?
Dr_ST
or not reading it the proper way
FunkyBob
moritz_s: you can start with a Q(), then |= each successive one for OR cases
moritz_s: but if you need to AND then, you can pas them as positional arguments to filter()
Dr_ST: "the good info" being?
Dr_ST
how much I have objects in each cluster
it seems the above query does not filter by the count
moritz_s
FunkyBob: yeah, you're right
ksoviero joined the channel
moritz_s: but reduce(and_, list_of_qs) should work as well
Dr_ST
for instance using DockingLigand.objects.filter(docking=self).annotate(cluster_count=Count('cluster')).order_by('-cluster_count')[0] should return 10 since this "cluster field" has the most important number of objects
FunkyBob
Dr_ST: each object will have clister_count as a property
elmcrest
FunkyBob: so positional args to filter() and ANDed so to speak?
FunkyBob
moritz_s: yes
Dr_ST
but it returns 9 ...
FunkyBob
elmcrest: right, just like their keyword args are
Dr_ST: .... and?
Dr_ST
well 9 is not 10 :-)
FunkyBob
Dr_ST: look, if you want hlep, you need to explain stuff in detail , instead of assuming we can read your mind/screen
Dr_ST
ok, back to the point
elmcrest
FunkyBob Ok good to know... Maybe moritz_s suggestion is a little more explicite but anyway
Dr_ST
I have 100 objects (or more) which can have a "cluster" field in common
some are in cluster 1, some in cluster 2, some in cluster 3, etc
I want to now which cluster is the most populated
FunkyBob
ah, well
but just the cluster and its size?
Dr_ST
from the data I know this is cluster 2 which has 10 members
asbjxrn joined the channel
yep
The object is more complex, but I want to sort according to cluster size, to keep only the most populated cluster
Hello. I can't make auth with facebook through python-social-auth - it causes error 404 with "Backend not found".
FunkyBob
now you get a queryset that yields dicts with two values: cluster and count
ameenkhan07 joined the channel
asbjxrn has quit
Silvering
dAnjou: For my mind, the best solution is from the local app, to fetch a json file, store is locally and update the database. This is possible I think so
kosc
But I already add 'social.backends.facebook.FacebookOAuth2' to my AUTHORIZATION_BACKENDS.
Dr_ST
FunkyBob, haaaaaaaaa, the queryset returns a dict ... thanks :-)
BeerLover has quit
kosc
*AUTHENTIFICATION
FunkyBob
Dr_ST: values() querysets do
Dr_ST: actually you probably wanted aggregate()
tacohat has quit
Dr_ST
this is what was missing, I was trying to get the object alone
ok, thanks, gtg eating, I'll experience just after lunch :-)
Silvering: It's possible but not trivial to handle conflicts and such. Why are you needing this "offline" mode?
asbjxrn joined the channel
Silvering
jtiai : Because this app will works like a "show" without internet connection. After the show the app could be updated
BeerLover has quit
ameenkhan07
django newbie, need help, difficulty in sessions, after logging in i am trying to check if session has an entry of the user, by the request.user but apparently session is not getting the user entry in it. https://dpaste.de/4Jfi .
Laanthera has quit
harmaahylje
Problem solved, my my.cnf didn't have good enough permissions
ameenkhan07
print request.user to no avail, shouldnt their be some sort of output indicating the user
paiti has quit
moritz_s
ameenkhan07: request.user is only set after login()
gdi has quit
Boogymanx
I have a CharField with choices but I'd like to display each choice individually in a form based on the model. I currently have this: https://dpaste.de/uzYG but it keeps displaying all the languages in one select. Could anyone tell me what I'm doing wrong?
jtiai
Boogymanx: Which widget you would like to use?
ameenkhan07
moritz_s: done the login, and found out the fault. But when trying with android http request to the django backend, session is not being maintained
Boogymanx
jtiai: a select widget is okay for the knowledge_level for the time being, I'd just like the languages themselves displayed as text instead of another select
Stolas joined the channel
moritz_s
ameenkhan07: the android http request probably doesn't store the cookies
jtiai
Boogymanx: That mechanism you show can only handle one single language. You probably would like to figure out to handle several (prefixed) forms to your view.
ameenkhan07
moritz_s: ohh, so what should i do in that case?
is that something to be done on the android part or the backend django part?
prabampm has quit
moritz_s
ameenkhan07: Django can't know who you are if you don't send it the cookies back.
ameenkhan07
moritz_s: could you explain a little more?
Silvering
jtiai : I think I found an easier solution. I don't need a django app locally. If I create a simple website which fetch text content from a json file downloaded when internet is available, I'm happy! The json file is created by the django app hosted by heroku! Done!
jtiai
Boogymanx: I mean that what you're trying to do doesn't work that way. You need one form for each language, and in a view you need to construct and loop over each language form. Nothing magical.
pilva joined the channel
sayan joined the channel
Boogymanx
jtiai: Is there no way to do that programmatically? Loop over all languages in the model and create the forms that way?
AndyRez has quit
jtiai: Or is my model wrong in this case?
moritz_s
ameenkhan07: I won't explain how cookies work, you can google that, but to answer your questions: you have to do something on the android part
AndyRez joined the channel
jtiai
Boogymanx: No. most probably your view and modelform is wrong.
Boogymanx: And thus your template.
asbjxrn joined the channel
Boogymanx
jtiai: The view is the view you and FunkyBob helped me with yesterday, only with language_form=LanguageForm() appended and adding language_form to the render()
Oli has quit
Stolas has quit
ameenkhan07
moritz_s: AWESOME, all needed to know, thanks :)
jtiai
Boogymanx: Well if you add _one_ form you can handle only _one_ language and it's level.
(I only just started working on this, which is why I haven't added a is_valid and save() for it yet, want to get it displaying correctly before I do that)
Am I still connected? <_<
FunkyBob
YES
oops
gkap joined the channel
[coda] joined the channel
gkaplan has quit
dAnjou
Silvering: are you aware that you can generate JSON on the fly with django from, let's say, a database query result