#django

/

      • Guddu has quit
      • knbk joined the channel
      • ArtisOracle joined the channel
      • iajrz has left the channel
      • sleblanc
        same question but in other words, is there a way to apply the same filtering construct (e.g. Q-objects) to both querysets and lists (or even single items) to maintain DRY? (I hope I won't get kicked for this), something similar to Linq and Linq to SQL in C#/.NET...
      • knbk
        sleblanc: please rephrase? I'm not exactly sure what you're getting at
      • FunkyBob
        sleblanc: there is a linq-alike lib for python
      • but... no...currently QuerySets are for constructing SQL queries
      • what's your real problem here? what are you hoping to solve with this?
      • sleblanc
        So I have a model that inherits from a "PublishableMixin". The mixin adds "publication_date(dt)", "publication_end_date(dt)" and "is_published(bool)" fields to the model. I know how to build a `filter` construct to filter published items from unpublished items. Now I'd like to apply the same construct to a single object, so that its "is_published" method does not lead to code repeat (even worse than that, it's code repeat in a different "lang
      • uage", so prone to errors)
      • FunkyBob
        sleblanc: stop writing walls of text
      • they're hard to read
      • sleblanc
        Do you want me to apologize?
      • FunkyBob
        no, I just want you to not do it again, please
      • so you want to avoid implementing the same logic in two places
      • Guddu joined the channel
      • sleblanc
        Yes, exactly (sorry for being rude)
      • the_rat has quit
      • FunkyBob
        certainly agree with the idea
      • sleblanc
        I would like to avoid hitting the database just for this
      • I know I could do Object.objects.filter(pk=object.pk).filter(…)
      • I dabbled in C# a few months ago and they have this somehow great feature (IMO) called Linq. It's a subset of SQL-like syntax built into the language, but with additional greatness:
      • it works with both regular iterables and "database abstractions"
      • FunkyBob
        yeah, friend of mine raves about linq
      • sleblanc
        In my opinion, QuerySets and the Q interface could become Django's own Linq
      • FunkyBob
        indeed
      • carljm
        sleblanc: I think ptone had a project he was working on a while back for that (applying Q objects to lists of Python objects)
      • FunkyBob
        the separation layer is somewhat there, too
      • carljm
        not sure where it went (if anywhere)
      • sleblanc
        carljm, thanks for the cue
      • kenbolton joined the channel
      • carljm, is this what you were talking about? https://github.com/ptone/django-predicate
      • Guddu has quit
      • carljm
        sleblanc: yep
      • buzzzz has quit
      • sleblanc
        Seems like it addresses the needs. Thanks!
      • hillaj joined the channel
      • realnot has quit
      • bmbouter is now known as bmbouter_afk
      • bryanh_ joined the channel
      • bryanh has quit
      • bryanh_ is now known as bryanh
      • buzzzz joined the channel
      • hillaj has quit
      • LotusEcho joined the channel
      • Bounder has quit
      • Hairy joined the channel
      • yomilk joined the channel
      • rojem has quit
      • rojem joined the channel
      • grindmodeon joined the channel
      • nimomo joined the channel
      • Siecje joined the channel
      • bathtub95 joined the channel
      • josuebrunel joined the channel
      • bathtub95
        I'm having some issues installing the reportlab package in my virtualenv. Any ideas? https://dpaste.de/uax0
      • rojem has quit
      • nimomo has quit
      • Hairy joined the channel
      • dangayle has quit
      • FunkyBob
        bathtub95: it needs to compile stuff, but you don't have the Python headers installed
      • for your OS install the python-dev package
      • rpkilby joined the channel
      • bathtub95
        FunkyBob: Already installed python-dev and still having issues..
      • Is there any way the virtualenv could be having trouble accessing it? I'm on ubuntu
      • knbk has quit
      • FunkyBob
        did you install python dev for the right python version?
      • you can clearly see there it can't find Python.h
      • rmwdeveloper has quit
      • DLSteve has quit
      • OtherAllan has quit
      • acangiani joined the channel
      • VinceZa joined the channel
      • veb joined the channel
      • Hairy joined the channel
      • bathtub95
        FunkyBob: I just installed python-dev through apt-get.. Wasn't aware there was seperate versions. I'm using python 3.4
      • FunkyBob
        then you did a pip uninstall and pip install of reportlab?
      • micahd has left the channel
      • and whichever of its deps require comiling
      • compiling
      • bathtub95
        Yep I started again with a totally new virtualenv. Looks like there is a python3-dev package so I'll try installing that
      • VinceZa joined the channel
      • realnot joined the channel
      • dkb20k joined the channel
      • Hairy joined the channel
      • rpkilby has quit
      • bkuberek joined the channel
      • bwreilly has quit
      • rtpg joined the channel
      • holler has quit
      • snurfery has quit
      • bryanh has quit
      • lukeas14 has quit
      • scofmb has quit
      • mbrochh joined the channel
      • mbrochh
        hmm...
      • let's say i want to write a datamigration
      • and i really just want to iterate over all instances and call save()
      • because i added some magic to save()
      • somehow my magic in save doesn't get called
      • (it's defined on an abstract base class)
      • Hairy joined the channel
      • jonatas_oliveira has quit
      • deb has quit
      • joshlegs joined the channel
      • sargas joined the channel
      • hillaj joined the channel
      • ybathia has quit
      • cristobal has left the channel
      • jsaq007_ joined the channel
      • realnot has quit
      • stickperson joined the channel
      • jsaq007 has quit
      • jsaq007_ is now known as jsaq007
      • heedly has quit
      • JayFK has quit
      • SmileyChris
        mbrochh: as it says in the warning here: https://docs.djangoproject.com/en/1.8/topics/mi...
      • mbrochh: best way would be to abstract that logic so you can call the function independently from save() in your migration
      • mbrochh
        SmileyChris: thanks! makes sense.
      • yup, that's what i ended up doing.
      • Bounder joined the channel
      • grindmodeon has left the channel
      • ckpoint joined the channel
      • skift has quit
      • nimomo joined the channel
      • Bounder has quit
      • x1337807x has quit
      • EyePulp joined the channel
      • michaeldavis joined the channel
      • sleblanc
        bathtub95, did you solve your problem? On many distros python-dev (and python- packages) refer to Python 2 instead of 3.
      • nimomo has quit
      • jsaq007 has quit
      • FunkyBob
        fark... fucking Amazon... breaking command-click on their menu
      • bathtub95 has quit
      • sleblanc
        FunkyBob, I have even seen sites break middle click
      • FunkyBob
        eh?
      • madness
      • sleblanc
        the only solution I could find was to right click → open in new tab
      • FunkyBob
        yeah
      • hey, anyone here ever used Amazon EFS?
      • sleblanc
        Never heard of it, is it new?
      • FunkyBob
        seems it may well be...
      • basically elastic NFSv4 storage
      • sleblanc
        Sounds cool
      • FunkyBob
        $0.30 per GB-month
      • sleblanc
        Regarding sites breaking clicks and keyboard handling, there was this interesting piece I read a while ago: https://medium.com/medium-eng/the-curious-case-...
      • Hairy joined the channel
      • TraceEv joined the channel
      • TraceEv has quit