#django

/

      • FunkyBob
        repaste your view
      • jessamynsmith
        Ugggh mysqlclient hell
      • sydbarret
      • FunkyBob
        jessamynsmith: self inflicted, no sympathy :P
      • jessamynsmith
        Basically, no matter what I tried, I could not get mysqlclient to see the libssl
      • FunkyBob: *I* wouldn't use it, but clients do what they do
      • FunkyBob
      • sydbarret: you are passing a fields list... STOP IT
      • jessamynsmith
        anyway, the solution, apparently, was to mysql-connector-python
      • in case that helps anyone else
      • it seems that anaconda just... destroys mysqlclient in some way
      • well, let's face it, anaconda takes over your machine with a rusty rake
      • FunkyBob
        ah... conda
      • jessamynsmith
        right?
      • FunkyBob
        yeah
      • mvanorder has quit
      • jessamynsmith
        how often do you have some weird and mysterious problem... and it turns out to be anaconda
      • josepharmbruster joined the channel
      • FunkyBob: so, how terrible is this... it's a set of courses, and one requires anaconda, and the instructions for the other fail if you have anaconda installed, and they are in the same semester
      • FunkyBob
        urk
      • ciaala has quit
      • jessamynsmith
        FunkyBob: oh, and it gets better... installing mysqlclient in a python2 env worked just fine. Of course, the course is py3/django2.
      • anyway, I felt bad for this poor student... they are just supposed to be doing a first django course, not trying to figure out library conflicts
      • chasonchaffin has quit
      • FunkyBob
        jessamynsmith: of course... why would anyone use py2? :)
      • jessamynsmith
        well, yeah, obviously!
      • it would be nice if mysqlclient worked properly in py3 with anaconda, but...
      • nearly every interaction I have with anaconda solidifies my hatred
      • FunkyBob
        or, you know, the course didn't encourage people to use shit tools like mysql :)
      • yeah, I have to use anaconda for my new job... but... I resist
      • jessamynsmith
        also sad, BUT based on what I saw online, postgres has the same issue with py3/anaconda
      • FunkyBob
        pip install psycopg2-binary
      • :P
      • catonano_ joined the channel
      • reminds me... I should spend some time on egress again some time
      • jessamynsmith
        there were a ton of google hits about postgres client not finding libssl
      • though I didn't try it myself, so I don't know
      • FunkyBob
        last time I tried to run django tests with egress, it was hitting a problem where the array type test table was created without the array field
      • catonano has quit
      • catonano_ is now known as catonano
      • jessamynsmith
        is egress a driver, FunkyBob?
      • FunkyBob
        yes
      • one I wrote for experience
      • jessamynsmith
        mm, cool
      • FunkyBob
        binds to libpq, uses the binary protocol...
      • django.db.utils.ProgrammingError: ('ERROR: column postgres_tests_integerarraymodel.field does not exist\nLINE 1: SELECT "postgres_tests_integerarraymodel"."id", "postgres_te...\n ^\n', '42703')
      • PaulWay[w]
        Is there a common library or method to handle filtering views in Django?
      • jessamynsmith
        PaulWay[w]: say more?
      • whatever_hi has quit
      • PaulWay[w]
        E.g. I have a list of books owned by the user and they want to just list sci-fi (i.e. by values of a 'genre' related field), or books with 'stone' in their name.
      • darkhanb has quit
      • Something that would look for e.g. a 'filter' or 'search' parameter in the request, then add filters to the queryset based on those filters.
      • FunkyBob
        having a search field is simple... interpreting it, and working out which fields to search? not so much
      • PaulWay[w]
        Yeah.
      • I realise that can end up being complex.
      • But I'd like something to at least take care of the simple stuff.
      • OK, I'll just write it myself then :-)
      • jessamynsmith
        PaulWay[w]: I've certainly used this https://github.com/carltongibson/django-filter
      • andyhoang joined the channel
      • PaulWay[w]
        Sounds like what I want, thanks jessamynsmith!
      • drodger has quit
      • FunkyBob
        isn't there a django-filter2 ?
      • drodger joined the channel
      • drodger has quit
      • drodger joined the channel
      • jessamynsmith
        django-filter has a version 2, I wasn't aware of another package
      • azulakina has quit
      • sydbarret has quit
      • FunkyBob: so help me, this poor client's prof INSISTS she use mysqlclient so I guess I'll see if I can figure the magic incantation to make it play nicely with anaconda
      • FunkyBob
        :/
      • jessamynsmith
        I feel like having a little snippy conversation about which database is recommended
      • FunkyBob
        go track down the video of the talk "Just use postgres"
      • jessamynsmith
      • azulakina joined the channel
      • chasonchaffin joined the channel
      • iiie has quit
      • FunkyBob
        yep
      • josepharmbruster has quit
      • jessamynsmith
        thanks!
      • FunkyBob
        jessamynsmith: I was in the audience :)
      • jessamynsmith
        nice!
      • jessamynsmith has quit
      • MickeySoFine has quit
      • two_tired2 joined the channel
      • iiie joined the channel
      • theWhisper_ joined the channel
      • catonano has quit
      • lavalamp has quit
      • waveframe has quit
      • Leeds has quit
      • catonano joined the channel
      • andyhoang joined the channel
      • babykosh has quit
      • opticdel1sion joined the channel
      • opticdelusion has quit
      • opticdel1sion is now known as opticdelusion
      • wreed has quit
      • eperzhand has quit
      • darkhanb joined the channel
      • djapo
        how can i filter a datetime field for an item created in the last hour
      • ?
      • schinckel
        Foo.objects.filter(created__gte=datetime.datetime.utcnow() - datetime.timedelta(hours=1))
      • djapo
        schinckel: thanks, is that datetime or django's datetime timezone helper
      • lolidunno joined the channel
      • oh, it works for both
      • schinckel
        In that case I just used python's datetime, but that assumes it's stored as UTC.
      • catonano has quit
      • Oli has quit
      • FlavioZ joined the channel
      • Oli joined the channel
      • BuffaloSoldier joined the channel
      • jgadelange has quit
      • jgadelange joined the channel
      • esrse joined the channel
      • eblip
        hey i want to have a delete button on some records...but some things i want to allow staff to delete ..and other things i only want main admin person to delete
      • how do i go about that
      • i know there is something called is_staff
      • ah sorry maybe is_superuser
      • is that what i should use
      • schinckel
        If it's in the admin, that will already use delete_* permissions.
      • Dunedan joined the channel
      • eblip
        im not using the admin panel...im am building a dashboard for all the stuff i need to do
      • ill look into delete_* permissions
      • if it works for admin panel ..then i should be able to incorporate it into my dashboard
      • wreed joined the channel
      • Dunedan_ has quit
      • xcm joined the channel
      • schinckel
        You probably should use permissions rather than explicitly checking is_superuser anyway.
      • eblip
        thanks schinckel, ill look into setting that up
      • GinFuyou
        yeah, permissions, you can your own too
      • eblip
        great
      • robotme joined the channel
      • andyhoang joined the channel
      • Xaldafax has quit
      • DeSigna has quit
      • bazzzz joined the channel
      • DeSigna joined the channel
      • eht joined the channel
      • robotme has quit
      • robotme joined the channel
      • andyhoang joined the channel
      • robotme has quit
      • robotme joined the channel
      • andyhoang joined the channel
      • EyePulp joined the channel
      • lqez joined the channel
      • mikeliss has quit
      • chasonchaffin has quit
      • bazzzz has quit
      • eht has quit