#django

/

      • anth_x
        my ranges are short enough that i could brute-force iterate over every day in the range and test, but that seems silly.
      • capella-da-star has quit
      • gthank joined the channel
      • FunkyBob
        nah... use the weekday to skip to the next tuesday, and then add timedelta(days=7)
      • veb joined the channel
      • anth_x
        yeah, good enough. thanks
      • FunkyBob
        so if d.weekday() == 2 you're on a Tuesday...
      • and some simple math can tell you how many days to skip to align
      • SmileyChris
      • FunkyBob: until someone decides that they want it on the Xth every month
      • FunkyBob: where X > 28 :P
      • datakid
        when using models.FileField, how do I turn a path into a file object. Or rather, when I have a file path, how do I save a models.FileField() properly?
      • FunkyBob
        rrule
      • aidan's project uses a rrule lib
      • SmileyChris
        datakid: a full filesystem path, or a path relative to the storage engine root?
      • datakid
        SmileyChris, fill file system
      • s/fill/full
      • FunkyBob
        datakid: typically you don't... it's abstracted throug hthe storage engine
      • why do you want to?
      • datakid
        I hae an object class that will have a PDF attached to it. I am importing the first bunch of data, and I have the filepath
      • SmileyChris
        datakid: then you save it inside the engine and set the field to the return value (a File)
      • FunkyBob
        ah, well
      • scriptThis joined the channel
      • acangiani has quit
      • datakid
        "object class that will have a PDF attached to it" = has a models.FileField()
      • FunkyBob
        for imports and updates... you can just assign the path to hte field
      • SmileyChris
        datakid: you can just calculate the relative path and set it to that
      • datakid
        FunkyBob, really?
      • SmileyChris
        datakid: then just put them in the right place
      • FunkyBob
        make sure, though, to trim the path to relative to the storage engine's root [MEDIA_ROOT by default]
      • I've done it in the past
      • if the files are already in the right place
      • datakid
        FunkyBob, SmileyChris ok. And the file will then be available to the user through the template
      • ok, thanks
      • SmileyChris
        it's the field's purest form really (FileField is really just a fancy shmancy charfield)
      • datakid
        SmileyChris, that's the info I was looking for, thanks. Yep, I'll do that. Tx all
      • paridin has quit
      • rahulrrixe joined the channel
      • chipotle joined the channel
      • ForSpareParts joined the channel
      • ForSpareParts has quit
      • ybathia joined the channel
      • mfcovington
        Anyone know a way to add dividers between nodes when building menus in CMS using menus.base.NavigationNode?
      • FunkyBob
        mfcovington: you mean django-cms ?
      • mfcovington
        Yes, sorry.
      • ybathia_ joined the channel
      • grumpi joined the channel
      • ArtisOracle has quit
      • grumpi has quit
      • ybathia has quit
      • ybathia_ is now known as ybathia
      • jessamynsmith has quit
      • Earlo joined the channel
      • b3free has quit
      • semiac_ joined the channel
      • al-damiri joined the channel
      • Goopyo joined the channel
      • Sewar joined the channel
      • kenbolton has quit
      • Goopyo_ joined the channel
      • jMyles has quit
      • joshlegs has quit
      • skift has quit
      • skift joined the channel
      • mfcovington has quit
      • skift has quit
      • skift joined the channel
      • bite joined the channel
      • Earlo has quit
      • jMyles joined the channel
      • mmikeym has quit
      • SmileyChris has quit
      • cromero joined the channel
      • elyezer joined the channel
      • rtpg joined the channel
      • elyezer_ joined the channel
      • ForSpareParts joined the channel
      • elyezer joined the channel
      • x1337807x joined the channel
      • encod3 joined the channel
      • elyezer has quit
      • elyezer joined the channel
      • elbaschid joined the channel
      • naro joined the channel
      • rtpg has quit
      • elyezer has quit
      • capella-da-star joined the channel
      • elyezer joined the channel
      • Kn|t3 joined the channel
      • rtpg joined the channel
      • elyezer_ joined the channel
      • rtpg has quit
      • elyezer joined the channel
      • mcspud joined the channel
      • atlasloewenherz joined the channel
      • stickperson joined the channel
      • datakid
        I"m getting the error "utf8' codec can't decode byte 0x95 in position 792: invalid start byte" but I have no idea what that means
      • elyezer joined the channel
      • the traceback doesn't make any sense. The error seems to be in the save() method, but it's in utf_8.pyc that hte problem happens
      • encod3 has quit
      • no indication of which field might be causing the error
      • encod3 joined the channel
      • how would I capture which field was causing the error?
      • ForSpareParts has quit
      • Itkovian joined the channel
      • FunkyBob
        datakid:it means you've got imporperly encoded data
      • dpaste the traceback
      • f3lp joined the channel
      • datakid
      • elyezer joined the channel
      • it's doesn't tell which field has the wrongly encoded data? And from what I can see all fields have the right encoding
      • FunkyBob
        so it looks like Django is trying to get a copy of the last executed query
      • Kn|t3 has quit
      • tuppa joined the channel
      • have you done something that means you're not using utf-8 encoding to your PGH?
      • datakid
        PGH?
      • atlasloewenherz has quit
      • I'm using py 2.7 but otherwise, I don' tthink so
      • at one point I use strptime but that is string into date
      • elyezer joined the channel
      • FunkyBob
        PG
      • postgres
      • datakid
        i will check pg now
      • Itkovian has quit
      • FunkyBob
        if you didn't change the config, then it's unlikely
      • encod3 has quit
      • datakid
        no, I didn't change anything
      • I just created the user, pw and then the db,
      • how could I tell what the encoding was on the db/table cols?
      • elyezer joined the channel
      • FunkyBob
        since you're getting the traceback in the browser, yuo should be able to open it up and see the values it's working with
      • datakid
        it's in ipython, not browser - I'm running an import script
      • pwnz0r joined the channel
      • elyezer has quit
      • elyezer joined the channel
      • HowardwLo joined the channel
      • hvyk joined the channel
      • elyezer_ joined the channel
      • Goopyo_ has quit
      • gah
      • some of my dates are strings
      • of course
      • sorry
      • ffs
      • FunkyBob
        np
      • but I don't see that causing that error
      • hvyk
        How can I pass variables from my template to my view functions as a parameter, I’ve tried GET parameters without luck and I don’t want to use a form
      • elyezer_ has quit
      • elyezer joined the channel
      • schinckel
        hvyk: You may use patterns in the url to pass them.