#django

/

      • heihei has quit
      • fynite joined the channel
      • fynite
        #/g/
      • mindcruzer
        il, first argument to your view function should be `request`
      • mstrcnvs
        il: the first argument to a view is always the request
      • il: url parameter are from the 2nd argument and on
      • parameters
      • il
        mstrcnvs, ok, thanks, applying this
      • kenju254 has quit
      • anth0ny has quit
      • mordonez has quit
      • mindcruzer
        you are also doing a POST request, so your video_id will be in request.POST.get('video_id'), not a URL parameter
      • exaroth joined the channel
      • il
        mstrcnvs, now I'm getting : get_related_videos() takes exactly 2 arguments (1 given)
      • dowwie joined the channel
      • mindcruzer, oh
      • mstrcnvs
        il: mindcruzer ^
      • what s/he said
      • anth0ny joined the channel
      • il: so remove the parameter from your view and instead use request.POST['video_id']
      • il
        alright, thanks mindcruzer and mstrcnvs
      • m8 joined the channel
      • nozavroni
        alright so I created an inline formset that allows me to create as many rental history records as I want, but how do I add the application form to the formset as well?
      • exaroth has quit
      • can I just add forms to the formset as I please?
      • fynite has quit
      • stephanb joined the channel
      • zflggr has quit
      • amogorkon
        Tjati: try running a debugger like https://docs.python.org/2/library/pdb.html on it, you might find the cause for your recursion that way
      • gthank joined the channel
      • il
        mindcruzer, mstrcnvs both request.POST.get('video_id') and request.POST['video_id'] are returning none, and I get the error: cannot concatenate 'str' and 'NoneType' objects (because I try to concat the 'video_id') in a string later on
      • zflggr joined the channel
      • amogorkon
        i doubt anyone can help you without looking through all your code, and that of your dependencies
      • mstrcnvs
        il: remove that contentType declaration in the ajax call
      • il
        mstrcnvs, same error
      • wait
      • let me restart
      • ThomasC has quit
      • mstrcnvs
        il: yes, and if doesn't work, paste the code again
      • Goopyo joined the channel
      • ThomasC joined the channel
      • nozavroni
        I have an application form and then rental history form, which all have fk's to application. how do I create a formset that has one application and then as many rental histories as necessary?
      • I've gotten it to display rental histories no problem, but I don't know how to also make it display the application form
      • mattmcc
        nozavroni: Handle the application with a separate form object
      • nozavroni
        so, create the application form and the inline formset separately?
      • mattmcc
        Yeah.
      • pagenoare
        /win 20
      • oops
      • mattmcc
        You can use multiple form/formsets objects to process the same POST request.
      • Goopyo has quit
      • il
        mstrcnvs, it works, and then it doesn't work
      • Methodical has quit
      • mstrcnvs
        il: how can I help you?
      • il
        mstrcnvs, (I print the video_id, it prints ,and I get a 200 OK, and then another http request is sent and I get a 500)
      • mstrcnvs, not sure man
      • mstrcnvs
        il: inspect the response from the one that gets 500
      • luisalonsocn has quit
      • il
        mstrcnvs, returns None (while the other returns the video_id
      • mstrcnvs
        read the traceback
      • il
        mstrcnvs, there is no traceback
      • Goopyo joined the channel
      • mstrcnvs
        just 500?
      • isn't DEBUG True?
      • il
        mstrcnvs, 500, and returns None
      • mstrcnvs, yea that returns the "cannot concatenate 'str' and 'NoneType' objects" error
      • elyezer has quit
      • traceback is 2 lines
      • one is the string where I try to concat the video_id to the uri
      • the other is response = wrapped_callback(request, *callback_args, **callback_kwargs)
      • Not sure why 2 http requests are sent
      • NomadJim has quit
      • mstrcnvs
        its possible that you're sending an empty video_id in the script
      • il
        oh
      • amogorkon has quit
      • NomadJim joined the channel
      • softinio joined the channel
      • jlmitch5dev joined the channel
      • amikiri joined the channel
      • mstrcnvs
        il: console.log video_id before making the request
      • il
        ok
      • well, i send it directly through the console, mstrcnvs
      • like API.get_related_videos('D0qKDiq1fNw')
      • So it's there
      • mribeirodantas has quit
      • mstrcnvs
        il: open your browser developer tools, on the Network tab, inspect the POST request, see its parameters
      • see if video_id is there
      • il
        ok
      • ThomasC has quit
      • mstrcnvs, yea it's there, in form_data
      • or, Form Data
      • quetz has quit
      • codeme has quit
      • Swambo joined the channel
      • Swambo has quit
      • softinio has quit
      • njen joined the channel
      • njen
        hi there. i'm a designer working on a site using php and modx. i've come to accept that this is inferior to python and django, so i'd like to port my site to use those as a backend. i have tried to learn django myself but found it too difficult, so i'm looking to hire a developer to help me. as someone from a graphic design background, i don't really know enough about the workflow of the...
      • ...developer and how he would go about a project like this. what should i be doing to make it as easy as possible for someone to transfer my site to a django backend?
      • should i be giving him my existing (very badly coded) modx site to work with, or something more basic, like a static site with some minimal templating or includes? or do i go even more simple than that, just telling the developer the structure of the site and how i want it organised? what's the best way to make his life easier and expedite things?
      • i have some very basic knowledge of flask; would it be helpful to try to make a basic working system there, because of the similarities between jinja2 and django templating?
      • bibhas has quit
      • apologies for the length of my question, and thanks in advance to anyone who can help
      • eVRiAL_ joined the channel
      • bmispelon has quit
      • daniel3_ joined the channel
      • daniel3_
        Hello guys, hope you all had a good turkey day.
      • eVRiAL has quit
      • Goopyo has quit
      • Question: If I use timezone.now() in the save function on a form, will that not update correctly since since it's not in the view?
      • jheyrlla joined the channel
      • Evie_Hammond has quit
      • Evie_Hammond joined the channel
      • adamsilver joined the channel
      • nozavroni
        calling is_valid() on my formset doesn't seem to activate its error messages
      • what am I missing?
      • mstrcnvs
        njen: you should code all the frontend, html css and javascript with dummy data and give it to him so he can develop the backend using real data and putting the templates into its places
      • Goopyo joined the channel
      • daniel3_
        nozavroni: whatdo you mean activate the error messages?
      • mstrcnvs
        daniel3_: wrong
      • nozavroni
        well, typically when I call is_valid() it populates my form's error messages
      • but calling it on the formset doesn't seem to do that
      • anth0ny has quit
      • njen
        ok mstrcnvs, thank you, i'll do that
      • eVRiAL joined the channel
      • mstrcnvs has quit
      • daniel3_
        mstrcnvs: Wrong? So it will call the right time if used in the save function?
      • njen
        only problem is is that there is no real data as yet
      • daniel3_
      • nozavroni
        uhh yeah but I dont see how that helps
      • eVRiAL_ has quit
      • the errors aren't there
      • zerick joined the channel
      • they aren't in the context
      • AndyRez joined the channel
      • so how can I render them if they arent there?
      • anth0ny joined the channel
      • crakrjak joined the channel
      • njen
        mstrcnvs: so when you say i should code all the frontend, does you just mean as a static site, with no templating or any php of any kind, and just leave that to him?
      • do you*
      • nozavroni
        I have an appform and a formset. I call is_valid() on both. the appform gets its errors in the template. the formset doesnt
      • jazzzu joined the channel
      • Goopyo has left the channel
      • formset.errors returns a list of three empty dicts
      • daniel3_
      • Thats kind of what I use for one of my forms.
      • jazzzu has quit
      • It's kind of the same concept of the documentation though. IF there are errors, which is its not coming back as is_valid, they would display that way.
      • I had the same problem where a form was not valid, but I couldn't figure out why at first.
      • nozavroni
        it displays three empty list items