#django

/

      • leonsas joined the channel
      • NomadJim joined the channel
      • nedbat has quit
      • nedbat_ joined the channel
      • jonash
        akahn0889: Just custom labels for True and False. It needs to be a boolean because it's a boolean semantically.
      • Nizumzen joined the channel
      • akahn0889
        jonash: Have you tried setting the labels in your form's attributes dictionary or something like that?
      • leonsas
        so I have a Person model with a groups many-to-many field. I'm trying to do a query like Person.objects.filter(groups=mygroups), where mygroups can be either None, or having some group ids. Problem is this doesn't work if mygroups is None, where i'd like to basically ignore and return all Persons
      • I can easily write an if statement and make it a different query, but was wondering if there's a better way in the same query
      • aarose has quit
      • akahn0889
        jonash: That way you're just keeping it a UI thing, not an internal necessity
      • bender314 has quit
      • melhiors has quit
      • mattmcc
        leonsas: Do the if check. They're not the same query, after all.
      • heihei joined the channel
      • akahn0889
        leonsas: try using ' __in = mygroups'in your query
      • nedbat_ has quit
      • leonsas
        Right yeah, I know the __in
      • futuredale has quit
      • but it seems like it'd be a similar query
      • except the None case should include all instead
      • ArcTanSusan has quit
      • Of course doing the check is trivial, but the query is not exactly a one liner, and this check would just make it uglier
      • heihei has quit
      • mattmcc
        Well, querysets are lazy.
      • akahn0889
        leonsas: You might want to use a Q object and throw an | in there.
      • leonsas
        Yeah, I'd probably use Q
      • mattmcc
        So, qs = Person.objects.all() ; if mygroups: qs = qs.filter(groups=mygroups)
      • basichash has quit
      • subleq has quit
      • mstrcnvs joined the channel
      • emperorcezar has quit
      • theshit123 joined the channel
      • amizya_ joined the channel
      • amizya has quit
      • amizya_ is now known as amizya
      • maraneta has quit
      • zingysaturn has quit
      • jonash
        akahn0889: I haven't but I wonder why it doesn't work if I set it in the model layer
      • theshit123
        Hi, i want make a view to add elements to a m2m relathionship, i want be able to add 5 at same tame so i think i need to use modelformset_factory, right now my formset display correctly the 5 elements, other think what i want to do is change the queryset for exclude one option but i am not be able to do it: https://dpaste.de/GJWb#L64,65,66,67
      • Nizumzen has quit
      • akahn0889
        jonash: Well, it depends on the form you are using. That is, validation and defaults can give you funky stuff.
      • mstrcnvs
        marsje: solved your problem?
      • ccmonster has quit
      • grafa has quit
      • mikerrrrrr joined the channel
      • jonash
        akahn0889: mmmm... funky stuff... I mean it shouldn't surprise me. And in this case it could even lead to bugs since it's now possible to submit the form without supplying any value
      • ValicekB has quit
      • dali joined the channel
      • akahn0889: OK, just had a look at the implementation. They're setting blank=True in the field's __init__. I think this should be skipped if 'choices' is given.
      • aarose joined the channel
      • evildmp joined the channel
      • onr joined the channel
      • fission6 has quit
      • akahn0889
        jonash: I would avoid messing with the __init__ method, maybe override the default widget? If it's just labels you want to change, just set the field's label.
      • lyles has quit
      • bradfordtoney has quit
      • EyePulp has quit
      • bradfordtoney joined the channel
      • marsje
        mstrcnvs: looks like it....
      • mstrcnvs: I added a WSGIPythonPath directive pointing to my django project and that seems to work
      • mstrcnvs
        yes, you need to point it to your virtualenv and your project path
      • marsje
        mstrcnvs: I also tried adding the same directory to the python-path parameter of WSGIDaemonProcess, but that didn't work
      • natea has quit
      • jonash
        akahn0889: I see how to solve this, yeah. I still think it's a bug
      • marsje
        mstrcnvs: I'm not using virtual-env
      • mstrcnvs
        yeah, this settings are really confusing
      • when to use WSGIPythonPath or python-path
      • but if it works, then, just accept it :p
      • marsje
        mstrcnvs: it sounds the same to me... but you can only have one WSGIPythonPath for all your virtual servers it seems
      • mstrcnvs
        don't think so
      • then you can have just one django instance running?
      • bkuberek has quit
      • marsje
        mstrcnvs: if I use it within the virtual server, it fails
      • wwnnbb has quit
      • akahn0889
        jonash: I'm not learned enough on django internals to know but you can file it.
      • marsje
        mstrcnvs: no, but you have to specify all paths to that one directive I guess
      • tholu has quit
      • siqi_ joined the channel
      • ValicekB joined the channel
      • eraldo joined the channel
      • colinbits has quit
      • windyhouser has quit
      • drowns has quit
      • windyhouser joined the channel
      • jreyno40 joined the channel
      • windyhouser has quit
      • bkuberek joined the channel
      • akahn0889 has quit
      • faldridg_ has quit
      • zalmoxes joined the channel
      • faldridge joined the channel
      • jonash has quit
      • zalmoxes
        hi, what's the correct way to create teh superuser password noninteractively?
      • ekke85 has quit
      • vakaras has quit
      • aarose has quit
      • mattmcc
        User.set_password
      • mstrcnvs
        Maior: you there?
      • elyezer joined the channel
      • grafa joined the channel
      • faldridge has quit
      • Maior
        mstrcnvs: sup?
      • (only vaguely; middle of a game of DotA...)
      • mstrcnvs
        Maior: where are your company located in London?
      • Ariel_Calzada has quit
      • Maior
        mstrcnvs: Moorgate (Cityish)
      • mstrcnvs
        not close to Paddington right?
      • Maior
        other side
      • mstrcnvs
        so no visit from your fellow here :'(
      • atlasloewenherz has quit
      • k5ehx has quit
      • rthat has quit
      • wait, is not that far
      • only 30 min with subway
      • quake_guy has quit
      • robvdl joined the channel
      • eraldo has quit
      • Loplin joined the channel
      • georgeirwin joined the channel
      • ArcTanSusan joined the channel
      • eraldo joined the channel
      • sgambino has quit
      • Loplin
        Hello, can someone help me with a query? I have some models, Profile, ProfileItem, Item, and Criteria, where ProfileItem is a through table for the Profile and Item ManyToMany relationship, and where Criteria has OneToMany(Item). I would like to Find all Criteria relevant to Profile, but filtering on a field in ProfileItem.
      • georgeirwin has quit
      • Ie. Profile.items.criteria_set().filter(ProfileItems__gt=0)
      • But, I'm not sure how to access that profileitems field while going through the 'items' related_name
      • eraldo has quit
      • djapo
        __
      • bkuberek has quit
      • gcollazo joined the channel
      • dali has quit
      • ValicekB has quit
      • Maior
        mstrcnvs: also depending on date/time I can head there
      • gumol joined the channel
      • Debnet has quit
      • bwreilly joined the channel
      • dali joined the channel
      • subleq joined the channel
      • evildmp has quit
      • Destos has quit
      • mstrcnvs
        Maior: I will stay 5 days in london, let's see if I get some time to visit your company, would that be a problem for you?
      • ValicekB joined the channel
      • sligodave has quit
      • Maior
        mstrcnvs: not at all, but since our presence in London is "me", lets just go for coffee? :P
      • mstrcnvs
        sure
      • bhitov has quit
      • Chris-D joined the channel
      • jreyno40 has quit
      • siqi_ has quit