#django

/

      • TopRamen has quit
      • willie
        cos thats something I'll need to know about very soon
      • mattmcc
        dmishe: Yeah, HttpResponseRedirect only supports http[s] and ftp.
      • jpadilla
        Is there any way to detect if there was a 404 raised before running a Middleware?
      • dmishe
        mattmcc thanks, I found the code for it, I can subclass and override that
      • jpadilla
        I basicly want to halt a custom middleware if there was a 404 raised before it
      • like a URL was not found
      • kennethreitz joined the channel
      • briancray has quit
      • mattmcc
        jpadilla: Assuming you're past process_view, you've got a response object that you can check the status code of.
      • __class__ joined the channel
      • thomasbartelmess joined the channel
      • jpadilla
        mattmcc: I'm using process_request
      • let me try that
      • kvda has quit
      • mattmcc
        Then you don't know if a 404 will result yet.
      • kvda joined the channel
      • chrisjones has quit
      • bwreilly has quit
      • jpadilla
        mattmcc: is there anyway to check if request.path exists in urls.py?
      • andredieb joined the channel
      • mattmcc
        It's not that simple, a view may raise a 404. You really can't predetermine the response type until the view's had a chance to run.
      • void
        jpadilla: resolve() method
      • jpadilla: in django.core.urlresovers
      • urlwolf has quit
      • punkrawkR has quit
      • willie has quit
      • chrisstreeter joined the channel
      • TopRamen joined the channel
      • jroll|dupe joined the channel
      • jroll|dupe has quit
      • rvincent has quit
      • krassinger
        i tried disabling the csrf middleware and it's still not working...
      • jroll|dupe joined the channel
      • hansy has quit
      • thomasbartelmess has quit
      • jroll has quit
      • F1skr has quit
      • void has quit
      • F1skr joined the channel
      • dmishe has quit
      • chrislkeller has quit
      • void joined the channel
      • ambar has quit
      • zatan has quit
      • neataroni has quit
      • merunner joined the channel
      • TopRamen has quit
      • CaptChaos joined the channel
      • CaptChaos
        Hey everyone. I know that in Python builtin arrays are rarely used in favor of lists. What's the equivalent construct for instances of a Django model?
      • I searched the Django docs but could not seem to find this. Perhaps I was searching for the wrong thing?
      • arpegius has quit
      • FunkyBob
        CaptChaos: perhaps you should explain what you want to use it for?
      • chutwig has quit
      • lists are a mutable, ordered sequence... tuples are immutable ordered sequences
      • CaptChaos: when you say 'array'... what sort of structure do you mean?
      • to me it's an ordered sequence of homogenous typed values... but in PHP land it's an ordered mapping
      • CaptChaos
        I am reading in content from a CSV file that I want to store in a model I have created. I have the code technically working, but the overhead from constant writing the DB is causing a problem when I have ~100,000 records in a CSV. Instead, I want to store approximately 100-500 in memory (I would normally do this in a list) and then write the contents to the models in less frequent chunks.
      • FunkyBob
        from my own experience...
      • I would use the csv.DictReader, pass its dicts into a ModelForm, and use a transaction to commit every few hundred records
      • RuslanPopov has quit
      • then you get nice, clean type conversion and validation... and models constructed for you...
      • kvda has quit
      • lambdaq joined the channel
      • kvda joined the channel
      • CaptChaos
        thanks FunkyBob, I'll start looking into that. I wrote the code without thinking in advance and since I already have the parsing and saving done row by row I was looking for a lazy way to get it done. It's an intial setup step, not something that users will do frequently. My old C++ thinking had my going towards arrays but it's probably better the learn some more "Django-ish" ways of doing it. :)
      • kvda has quit
      • pjs
        CaptChaos this may also be useful to you: https://docs.djangoproject.com/en/dev/ref/model...
      • FunkyBob
        CaptChaos: having done many bulk-import tools, that's what will get you the most results for the least work
      • yeah, there's that too...forgot about bulk_create because it's new
      • __class__ has quit
      • dray3 joined the channel
      • kvda joined the channel
      • houman has quit
      • joshfinnie has quit
      • wenzhixue joined the channel
      • hyperair has quit
      • JJMalina has quit
      • munga has quit
      • mgrouchy joined the channel
      • bradleyayers joined the channel
      • xlorm has quit
      • joshfinnie joined the channel
      • CaptChaos
        awesome guys. thanks
      • reading up now
      • jpadilla has quit
      • bradleyayers
        hi
      • bforbes has quit
      • TopRamen joined the channel
      • FunkyBob
        bradleyayers: !
      • mikewg joined the channel
      • bradleyayers
        so i am back in the country
      • FunkyBob
        huzzah!
      • bradleyayers
        since tuesday
      • jpk has quit
      • mgrouchy has quit
      • StuckMojo
        i need a little help with localization/translation
      • tweelybird joined the channel
      • FunkyBob
        StuckMojo: oi... interested in helping me with my other project? :)
      • StuckMojo
        tit for tat? sure ;)
      • FunkyBob
        heh
      • StuckMojo
        how do i deal with that proxy object?
      • FunkyBob
        not sure I can help much with l10n / i18n ... have never tried it
      • mikewg
        Hi all - I'm trying to use the messages framework with a function-based view on an external app (userena)
      • StuckMojo
        before the site got translated, that just printed the text label nicely
      • mikewg
      • but the message isn't quite making it to the template
      • StuckMojo
        i'm pretty sure this is because it's set to use the lazy translation
      • FunkyBob
        afk... meeting
      • StuckMojo
        from django.utils.translation import ugettext_lazy as _
      • macabre joined the channel
      • tweelybird
        Hi, are there any apps available for django+salesforce integeration?
      • StuckMojo
        aha! got it
      • print unicode(Media.MEDIA_TYPE_CHOICES[0][1])
      • yay!
      • jpadilla joined the channel
      • FunkyBob
        erk
      • __love__ has quit
      • anth0ny has left the channel
      • gongyiliao has quit
      • leandroa has quit
      • Leeds joined the channel
      • tweelybird has quit
      • kvda has quit
      • phildini_ joined the channel
      • phildini_ has quit
      • kvda joined the channel
      • citadelgrad has quit
      • andredieb has quit
      • phildini has quit
      • goldfish_ has quit
      • andredieb joined the channel
      • andredieb has quit
      • PKKid
        Awesome, ask a question, wait 1 minute.. then leave. :D
      • Rimo has quit
      • jroll|dupe has quit
      • TopRamen has quit
      • TopRamen joined the channel
      • maurycyp has quit
      • hyperair joined the channel
      • derks
        does anyone have any suggestions on how best to use CreateView and UpdateView with the same template? They both default to <app>/<model>_form.html
      • ?
      • unless the form contains some kind of 'url' parameter that points to the right endpoint?
      • FunkyBob
        just use action="" or ="."
      • only use '.' if you're strict about trailing /
      • derks
        oh. duh... yeah, that works. bad/good habit of always being explicity...
      • is there anything stored in the 'form' object that would tell me if it is a 'create' or 'update'?
      • annasob joined the channel
      • FunkyBob
        instance