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
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: 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
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
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"
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