#django

/

      • santiissopasse has quit
      • ehmatthes joined the channel
      • mribeirodantas
        FunkyBob: Hm..
      • Thank you FunkyBob
      • raadad has quit
      • FunkyBob
        basically, have your web server alias STATIC_URL to STATIC_ROOT and you're good
      • heedly has quit
      • zxq9 has quit
      • dali has quit
      • iqualfragile has quit
      • mazatta joined the channel
      • twoolie joined the channel
      • nicholasserra has quit
      • SiliconG has quit
      • Tjati has quit
      • MarbinDrakon joined the channel
      • dray3 has quit
      • dmanderson has quit
      • felixsamora has quit
      • felixsamora joined the channel
      • jrm2k6 has quit
      • jrm2k6 joined the channel
      • ojh joined the channel
      • Nelluk
        evenin'
      • FunkyBob: so if my goal is to go from JSON->MyModel with nap, i dont need to think about Publishers, right?
      • felixsamora has quit
      • jrm2k6 has quit
      • FunkyBob
        right
      • Nelluk
        ok
      • polishnorbi has quit
      • nicholasserra joined the channel
      • sohail has quit
      • skeet70 has quit
      • nicholasserra has quit
      • FunkyBob
        it's quite flexible, in truth
      • Nelluk
        it seems as though serializers.deserialize() is only intended to work on data that was originally serialized by django
      • FunkyBob
        well, yes... it' the counterpart to serializers.serialize, of course
      • felixsamora joined the channel
      • Nelluk
        but im not started with MyModel data, im starting with external data. so API-JSON -> my model
      • polishnorbi joined the channel
      • hyperair has quit
      • markekramer has left the channel
      • arkore has quit
      • brimpa has quit
      • d0c0nnor joined the channel
      • schinckel
        Nelluk: The best way to turn JSON data into a model is to use a form.
      • (ie, json.loads() the data, and then pass that to a form)
      • Sample has quit
      • That way you can get form validation to ensure your data is valid.
      • Nelluk
        hm
      • arkore joined the channel
      • d0c0nnor has quit
      • Qowface has quit
      • hwrd|work has quit
      • Haldor joined the channel
      • bwreilly has quit
      • gaplus joined the channel
      • the one thing i like better about Symfony over Django is the tutorials.
      • gaplus
        is there anyone who has used django with require.js before?
      • dali joined the channel
      • FSCV has quit
      • FunkyBob
        gaplus: we do
      • BojanBG has quit
      • pizo joined the channel
      • eigenholser has quit
      • gaplus
        FunkyBob: so the app I'm working on has a ton of data getting sent to the client via ajax, and I'm wondering if I should be using server templates for getting the data instead of using the client
      • FunkyBob: the reason I mention require js is because in my experience django templates and require js dont mix well
      • I guess first off I want to know whether theres a rule of thumb for how *bloated* a page can be before resorting to a server-side solution
      • Fush joined the channel
      • Nervosa
        Use REST?
      • gaplus
        Nervosa: I am using rest
      • dali has quit
      • Nervosa
        What are you thinking, have Django send json to the page?
      • schinckel
        gaplus: We do too.
      • gaplus
        Nervosa: well im working with some legacy code, and what they did was have an inline javascript in the template that made use of template variables within the script
      • so it was a weird hybrid of django template code and javascript
      • i dont know if thats normal
      • Nervosa
        gaplus: Sometimes that's unavoidable.
      • For example... you might want var apiToContact = "{% url ... %}";
      • gaplus
        yeah i dont really have strong objections to it but it caused a lot of issues when using require js
      • Nervosa
        Just run it -all- before require.js is used?
      • bwreilly joined the channel
      • sgambino joined the channel
      • gaplus
        So the issue with that is overlapping dependencies
      • FunkyBob
        you should be able to have inline fragments still call require
      • gaplus
        FunkyBob: I am able to technically, but I kept running into this problem where these global variables (like the jquery '$') wouldnt be global anymore, since I had to scope them specifically for the inline fragment
      • chrislkeller has quit
      • Nervosa
        You need jquery for your Django template vars?
      • Or it's bringing in code?
      • gaplus
        Nervosa: I need jquery for the inline scripts which make use of template vars
      • t_p has quit
      • Nervosa
        I've bumped into the same problem many times. I think I ended up moving jquery into the template, before require.js runs.
      • It sucks, but hands can sometimes be tied.
      • schinckel
        I use the 'jquery-embedded-into-requirejs' build.
      • Qowface joined the channel
      • visualshock joined the channel
      • gaplus
        schinckel: thanks I'll look into it
      • adrian_lc has quit
      • so without having looked at the build, does requirejs know if jquery is already loaded on the page?
      • PKKid2
        Hey guys, Is Django fast enough to scale?
      • gaplus
        or do you have to remove all jquery references to avoid conflicts?
      • schinckel
        gaplus: My setup is not to use other jqueries.
      • gaplus
        schinckel: how does that work if you use libraries which depend on jquery?
      • SoftwareMaven has quit
      • dman777 has quit
      • schinckel
        I have a require.config() or something set up, that loads all base dependencies (jquery, bootstrap, jquery.cookie)
      • PKKid2
        I have been reading the docs, but I don't see anywhere that it is mentioned.
      • schinckel
        It handles dependencies fine.
      • PKKid2: disqus use django. It scales fine.
      • PKKid2
        schinckel, So Django is web scaled?
      • schinckel
        So, are you a troll?
      • nkuttler
        django is web scale, yes
      • PKKid2
        ;)
      • MicahCarrick has quit
      • schinckel
      • FunkyBob
        wait for django 1.6... it's mind blowingly faster
      • PKKid2
        nkuttler, Thanks, I think I'll use it.
      • msc has quit
      • moneydouble has quit
      • schinckel
        gaplus: It automatically registers 'jquery' as an installed module, and then you can just have your other bits depend upon it.
      • msc joined the channel
      • dman777 joined the channel
      • gaplus
        schinckel: yes thats my current setup
      • schinckel
        gaplus: I have the following as my config.js: http://dpaste.com/1433247/
      • gaplus
        schinckel: but i guess im confused about how that works if you have jquery loaded before requirejs
      • schinckel
        gaplus: And in my base template, I have:
      • <script src="{% static 'js/require.js' %}"></script>
      • <script src="{% static 'js/config.js' %}"></script>
      • gaplus: That is the only way I load jquery now.
      • z0ran has quit
      • Any time I want something to use jquery, I do a:
      • require(['jquery'], function($) { … });
      • That will then wait until jquery is loaded before running that bit.
      • The only thing I have not _yet_ mastered is using r.js to combine files :(
      • I'm using a storage backend to version files though: http://dpaste.com/1433253/
      • gaplus
        schinckel: ok...so have you ever placed 'require(['jquery'], function($) { … });" in a django template, where you have an inline javascript in the brackets?
      • thats basically where I get in trouble
      • schinckel
        gaplus: Yes. Quite often. Indeed, I _just_ wrote some code then that does that!
      • gaplus
        schinckel: so when I did that, I was no longer able to use jquery in the dev console
      • $ became undefined
      • schinckel
        gaplus: Ah, that's the crux of the problem, then.
      • gaplus
        even though my script executed fine
      • schinckel
        $ = require('jquery')
      • (In your console, only).
      • Although, I thought it also set window.$ for legacy reasons.
      • Nervosa
        schinkel: I got r.js working pretty well with grunt.
      • gaplus
        yeah I tried that but no luck...didnt know about the $ = require('jquery') hack, thanks!!
      • schinckel
        Or, you could have 'window.$ = $' inside a code block.
      • gaplus
        (no luck with window.$)
      • schinckel
        Nervosa: I may have to bug you about that in a month or so...