#django

/

      • mattmcc
        1.5.x should be fine. Though obviously upgrading to PG 9.x would be ideal.
      • behelit
        yeah, i'd love that
      • but, you know ... it's not possible right now
      • daveb
        unless you are using some custom queries
      • the datbase for django should upgrade cleanly
      • to newer postgresql.
      • mattmcc
        Well, ugprading from 8.2 to 9.anything won't be trivial.
      • hwrdprkns has quit
      • behelit
        my hands are tied here. there are over 40k servers and they all have the same base installation. no touching.
      • hwrdprkns joined the channel
      • elyezer has quit
      • mattmcc
        We're talking about versions that are eight years apart.
      • durianshredder joined the channel
      • behelit: Something to keep in mind, once Django 1.7 is released in May-June, 1.5 won't be supported anymore.
      • MCPixel has quit
      • behelit
        mattmcc: i see. i'll make sure to disappear from the face of the earth before may then.
      • aidan
        40k servers holy moly
      • behelit
        aidan: they're not all running django. only like ten :)
      • aidan
        Property.objects.filter(reportschedule__next_due__range=(start, end)) .... that returns multiple property records because it's a M21 relationship. Can I just run distinct to get only the properties or is there a better way?
      • Laybunz has quit
      • FunkyBob
        upgrading to PG 9.3 and Django 1.6 will pay off so well
      • dlogs has quit
      • dlogs joined the channel
      • I speak from experience :)
      • aidan: Property.objects.filter(reportschedule__in=ReportSchedule.objects.filter(next_due__range=(start, end)).distinct()) ?
      • kyheo has quit
      • behelit
        ok, i might be able to go to 8.4
      • i'll know tomorrow
      • mattmcc, daveb: thanks a lot for your time
      • mstrcnvs has quit
      • ChrisMorgan joined the channel
      • dray3 joined the channel
      • JimmyNeutron has quit
      • dray3 has quit
      • dray3 joined the channel
      • armlesshobo joined the channel
      • behelit has quit
      • __machine has left the channel
      • bobonthenet has quit
      • Kayra joined the channel
      • JDShu joined the channel
      • manicouman joined the channel
      • aidan
        FunkyBob: ah nice
      • rosslyoung has quit
      • armlesshobo has quit
      • JDShu
        hi, why would the union operator on two query sets duplicate an object?
      • Kayra has quit
      • am I misunderstanding what the operator does?
      • FunkyBob
        there's a union operator? :)
      • Kayra joined the channel
      • JDShu
        '|'
      • __love__
        QS + QS ?
      • wilbur-d joined the channel
      • JDShu
        QS | QS
      • mattmcc
        JDShu: It doesn't do a union, it combines the criteria of the two querysets.
      • wilbur-d
        is there a way to find the GenericRelation fields on a model? they don't show up in _meta.virtual_fields
      • JDShu
        mattmcc: ah ok, I guess that's what I get for believing stack overflow, thanks!
      • mattmcc
        Heh.
      • JDShu
        what's the best way to get a union?
      • mattmcc
        Raw SQL. The ORM can't do them.
      • schinckel
        JDShu: Are you talking about a union in the SQL sense, or the mathematical set sense?
      • empty has quit
      • JDShu
        mathematical set
      • should I just do it in python?
      • FunkyBob
        you could call distinct()...
      • ah, if only we had a relational query language....
      • schinckel
        Then you want (qs1 | qs2).distinct()
      • (or is it +? I forget)
      • FunkyBob
        |
      • sonofdir_ has quit
      • fllr joined the channel
      • JDShu
        cool, thanks! let me try
      • djm- has quit
      • cwu has quit
      • windyhouser joined the channel
      • Kayra has quit
      • kenbolton joined the channel
      • rsymm619 joined the channel
      • unbracketed joined the channel
      • silent1mezzo joined the channel
      • sweet, this works, thanks again everybody :)
      • daveb
        FunkyBob: is there more to this line? child = parent.childrel ...?
      • toli has quit
      • FunkyBob
        daveb: no... that's just trying to reference the child instance in case it already exists
      • you know... follow the 1to1 relation backwards...
      • daveb
        got it
      • rsymm619 has quit
      • dray3 has quit
      • MCPixel joined the channel
      • opalepatrick has quit
      • cottons has quit
      • geekeasy has quit
      • cwu joined the channel
      • red23 joined the channel
      • ticketbot has quit
      • adamduren joined the channel
      • wilbur-d
        so the only way i've figured out to get GenericRelation fields from a model so far is to get all field names with _meta.get_all_field_names() then check each one to see if it's a GenericRelation. surely there must be a better way?
      • eVRiAL has quit
      • navneet_ has quit
      • ASUChander has quit
      • ASUChander joined the channel
      • clime has quit
      • FunkyBob
        wilbur-d: why would you want to programatically find them?
      • silent1mezzo has quit
      • wilbur-d
        wait... shit. actually i don't think i need to.
      • i THOUGHT i wanted to use them in a custom queryset. but i was thinking backwards
      • Mezmor joined the channel
      • HAHAHA DISREGARD THAT, I SUCK COCKS
      • mik3y has left the channel
      • rcscott has quit
      • sorry, that was probably inappropriate. a little bash.org humor
      • chromano has quit
      • ASUChander has quit
      • nicholasserra joined the channel
      • it's been a long day
      • josephkokenge has quit
      • Zifre_ joined the channel
      • josephkokenge joined the channel
      • aidan
      • fond memories
      • josephkokenge has quit
      • ASUChander joined the channel
      • wilbur-d
        indeed, i sometimes forget how old i am
      • red23
        Silly question: One of the first settings in settings.py is BASE_DIR. Yet this is nowhere to be found in the docs. What exactly is the recommended place for BASE_DIR to point to?
      • ifdef42 joined the channel
      • ifdef42
        in #python
      • FunkyBob
        red23: it's a helper for all your paths that need to be absolute
      • MarbinDrakon joined the channel
      • red23: it's not really a django setting
      • IVplay joined the channel
      • yuwang joined the channel
      • SmileyChris
        red23: and if you're starting a new project, you can probably leave it as what it defaults to
      • red23
        default: which is the directory that settings.py is in
      • armlesshobo joined the channel
      • Zifre has quit
      • SmileyChris
        no, the parent directory of that
      • ifdef42
        if i try to run sqlclear output against my postgres db, it complaints about a constraint not existing. when i look at the db, it appears the hash at the end of the constraint name is 16 hex chars, but the sqlclear output has only 8 hex chars (different)
      • FunkyBob
        it defaults to your project workspace dir...
      • ifdef42
        familiar issue?
      • this is with django 1.5.4 on ubuntu 13.10 fwiw
      • red23
        os.path.dirname(os.path.dirname(__file__)) I know this is python question but how is this the directory above settings.py
      • riseriyo has quit
      • ehmatthes joined the channel
      • lduros has quit
      • mattmcc
        If the first dirname is the directory containing settings.py ..
      • FunkyBob
        ifdef42: did you change django versions at some point?
      • ifdef42
        btw when i said "in #python" that was the last bit of "/join #python" that got misdirected to the wrong window, not a jab :)
      • FunkyBob: now that you mention it... :)
      • ASUChander has quit
      • i was using django 1.4, and am trying to update to 1.5 on my way to pip installing the latest and fully migrating