#django

/

      • apollo13
        avafab: did you read the tutorial?
      • + the template docs?
      • avafab
        apollo13 could you please address me where to find more informations?
      • shredding
        parin: You can simplejson.dump a list
      • apollo13
      • ticketbot
      • avafab
        tnx
      • andrkavr joined the channel
      • ErvisTusha has quit
      • Squarepy joined the channel
      • jasondotstar joined the channel
      • andrkavr has quit
      • estebistec has quit
      • parin
        shredding: i am reading the documentation of simplejson, and yes, it is better than serialization. Thanks for your help :)
      • avafab has quit
      • m0n5t3r has quit
      • m0n5t3r joined the channel
      • what_larks joined the channel
      • subbyyy has quit
      • ianawilson has quit
      • ianawilson joined the channel
      • passy joined the channel
      • OldCoder_ has quit
      • ben174 has quit
      • leetrout has quit
      • sgambino joined the channel
      • rtnpro joined the channel
      • spirat
        apollo13: the token is in the cookies, but the ajaxBeforeSend doesn't seem to work. The ajax POST doesn't send a modified header with the token
      • apollo13
        spirat: then use the debugger to step through the code
      • a13x15
        parin: you may find django-tastypie or django rest framework useful
      • ineedarobot
        hey all, I want to create a form for a model. One attribute within this model is foreign key to another model. I want to allow users to create the foreign model within the form - sort of a subform. I have goggled and checked djangopackages but cannot see anything to help. Can anyone please guide me in the right direction?
      • amigo has quit
      • raijin has quit
      • spirat
        apollo13: which code? The $.ajax() one?
      • apollo13
        spirat: I'd set a breakpoint in the first line of ajaxSetup
      • parin
        a13x15: thanks ! I don't know about REST protocol. Please can you give some links for learning it ?
      • spirat
        apollo13: which is where? I'm afraid you're talking about a function that I don't call directly and is in the jquery.js file (which is unreadable as it is)
      • apollo13
        spirat: no, you did write an ajaxSetup function I assume
      • spirat: ah, the beforeSend callback
      • spirat
        apollo13: Alright, my bad.. I was focused on BeforeSend
      • apollo13
        yeah, first line of that
      • also: Due to a bug introduced in jQuery 1.5, the example above will not work correctly on that version. Make sure you are running at least jQuery 1.5.1.
      • spirat
        Yeah I just download JQuery yesterday, should be fine :)
      • downloaded*
      • TerraAdoudel joined the channel
      • ah I think I get the problem...
      • I should do a setup everytime I do an ajax request right?
      • a13x15
        parin: you can take a look at the entry in the wikipedia for a quick introduction
      • apollo13
        spirat: no, you just need to call that function once, jquery will then automatically call beforesend for every ajax call
      • nkryptic
        ineedarobot: inline formsets are probably what you want and are part of Django => https://docs.djangoproject.com/en/1.5/topics/fo...
      • a13x15
        parin: in short django-tastypie makes easy to create an API that can be used from the client with ajax to access/manage your data
      • ineedarobot
        I Has anyone successfully implemented nested formsets ?
      • a2on has quit
      • apollo13
        nested forms are somewhat ugly but doable
      • ineedarobot
        apollo13: do you have any urls that could help please?
      • parin
        a13x15: okay
      • apollo13
        nope, closed source projects ;)
      • ineedarobot
        apollo13: lol, fair enough
      • apollo13: I am going to look at implementing this and will share it once completed. I wanted to check I was not implementing something already in core django or something readily available
      • spirat
        apollo13: yeah, well the problem is that when the page is loaded the ajaxSetup is called: http://bpaste.net/show/87815/ and at that point it doesn't enter the condition. If I copy paste that code jsute above the $.ajax, it works
      • nkryptic
        ineedarobot: did you look at inline formsets?
      • naro has quit
      • apollo13
        spirat: which condition?
      • ineedarobot
        nkryptic: yes, but i now need nested inline formsets
      • spirat
        apollo13: The one for the request type
      • apollo13
        spirat: during pageload ajaxSetup is called, you won't run into beforeSend at that point
      • spirat
        apollo13: I thought it was like a callback that was called for each ajax call
      • apollo13
        it is
      • spirat
        apollo13: then how come it works when I do it just above the ajax method? Should it be in the same <script> block?
      • ineedarobot
        nkryptic: I see the inlineformset_factory function has a form set param but I cannot find any docs on it.
      • apollo13
        spirat: shouldn't matter
      • spirat
        apollo13: that file is included at runtime with <script src...>, can it be related to the problem?
      • apollo13
        no
      • spirat
        strange then... the setup failed the first time, I assume.
      • nkryptic
        ineedarobot: I think it's old, but still pretty clear: http://charlesleifer.com/blog/djangos-inlinefor...
      • klrmn joined the channel
      • klrmn
        good mostly-morning
      • ineedarobot
        nkryptic: thank you for the link. I have checked through it and it does not seem to handle nested objects. for example if the RecipeIngredient had 'manufacturer = models.ForeignKey(Manufactorer)'
      • I think I can fudge it for my specific purpose as my top level model is sort of a through table (conceptually)
      • klrmn
        i have a situation where a template is complaining because it's not getting the right data…i've instrumented the thing that's supposed to give it the data, but it's not being called…i'm not sure how to proceed
      • gcbirzan
        klrmn: You could explain the problem more, give us some code/tracebacks...
      • jakobw joined the channel
      • nkryptic
        ineedarobot: I don't see how you could edit that on the same page - recipe form + multiple ingredients forms and each ingredient has a manufacturer form? what are your specific models/relationships?
      • ineedarobot
        nkryptic: use case for that example would be "a user wants to add an ingredient to a reciepe but it does not exist yet and would like to add it inline - but the problem is the manufacturer of the ingredient does not exist either
      • chrismed has quit
      • m0rpho joined the channel
      • klrmn
        gcbirzan: here's a traceback https://gist.github.com/klrmn/5277841
      • hoot has quit
      • apollo13
        well it want's a float, what is val at that point?
      • epicowl joined the channel
      • epicowl
        hey, I am trying to write a template tag that adds a value to the current context eg: {% order_total as order_total %} ... {{ order_total|somefilter }}, should I be using assignment tag? there is no format_string to pass in so not sure
      • ryannielson joined the channel
      • klrmn
        gcbirzan, apollo13: it's being passed an empty string. here's the code that is supposed to be feeding it values but isn't being called https://github.com/klrmn/moztrap/blob/suite_res...
      • apollo13
        klrmn: well then go up the stack to the point where completion gets called (or rather should get)
      • nkryptic
        epicowl: yes, use assignment tag. then your function would just not accept any arguments... def order_total(): return utils.get_order_total()
      • Jochem has quit
      • epicowl
        nkryptic: is there a way to make it work w/o passing a format_string? eg it only works if I do {% order_total "" as order_total %}
      • nkryptic
        epicowl: paste your template tag code
      • klrmn
        apollo13: that's the problem. i don't understand what's calling what, and the stack trace looks so circular that it's not being helpful
      • ineedarobot
        nkryptic: for my own example I have managed to make my nested model abstract and I can now skip a level ! :D
      • thanks
      • rolleiflex joined the channel
      • jpk joined the channel
      • apollo13
        klrmn: well, what makes you think that this method should get called at all?
      • chaingun has quit
      • tensory has left the channel
      • ineedarobot
        klrmn: i normally do a ctrl + F on the page the error is printed on. I search for my project name and then scroll down to the last match.
      • ineedarobot has quit
      • klrmn
        apollo13: because it's called https://github.com/klrmn/moztrap/blob/suite_res... in the template
      • ineedarobot: what application are you issuing ctrl-F in?
      • apollo13
        klrmn: open a shell and call it in the shell
      • maybe you get an exception the template system catches
      • spirat has quit
      • lduros has quit
      • Cromulent has quit
      • skullattack joined the channel
      • klrmn
        apollo13: the template system having a seperate error catching method would probably explain why the stack trace doesn't include anything in my project except for the last line
      • rh0dium has quit
      • apollo13: i used another page in the system as an example of how to do this page…added the same logging in the same places, and it gets called just fine
      • Cromulent joined the channel
      • apollo13
        well if you can't find anything throw pdb at it and step through
      • shredding has quit
      • subbyyy joined the channel
      • nkryptic
        klrmn: so, this works? ...filter(runcaseversion__caseversion__case__suites__in=self) from L323 in models.py. I thought you needed to assign a list value when using "__in"
      • Cromulent has quit
      • raijin joined the channel
      • klrmn
        nkryptic: that's the biggest question of all
      • opi has quit
      • nkryptic: i am wondering if the problem is at https://github.com/klrmn/moztrap/blob/suite_res... … i don't know what that line does.
      • apollo13
        klrmn: why don't you move the log to the start of the function?
      • klrmn
        apollo13: trying that now
      • apollo13
        if that works, your function is raising an error
      • dexterity joined the channel
      • klrmn
        that is in fact working. so i need to come up with something that works for line 323
      • apollo13: wonky m2m relationships makin my life miserable
      • apollo13
        I'd rather say db design fail, but well ;)
      • klrmn
        apollo13: i agree on that, but it's not my project to re-design the db for
      • nkryptic
        klrmn: anywhere you have code like ...suites__in=self does it work to change it to ...suites=self
      • jeroengerits joined the channel
      • jeroengerits has left the channel
      • klrmn
        nkryptic: sounds worth trying
      • naro joined the channel
      • omg, nkryptic, you're a genious!
      • tdelam joined the channel
      • anthonydb joined the channel
      • dexterity
        South complains that the field 'Task.created' doesn't have a default value and is not NULL, it's a trivial DateTimeField field, how would I best go about handling this in django 1.5?
      • right now I have "created = models.DateTimeField(auto_now_add=True)" should I set a default value?
      • AGreyCrane has quit
      • adamsilver joined the channel
      • apollo13
        dexterity: south asks you if you want to set a default value for the migration