#django

/

      • cellopin
        Its readonly and I don't want it to be a modelchoice so displaying it as textfield would be better
      • mattmcc
        Then you should exclude it from the form entirely and just display it in your template.
      • ypcs has quit
      • cellopin
        ohh.. I see. If ever I should implement autocomplete in the future do you have suggestions like what modules to look at?
      • moonkid has quit
      • mattmcc
        There's a number of apps or snippets out there, just google django autocomplete.
      • cellopin
        thank you mattmcc
      • moonkid joined the channel
      • al1o has quit
      • al1o joined the channel
      • bearish joined the channel
      • stickperson joined the channel
      • Rouxi joined the channel
      • mekhami has quit
      • bearish has quit
      • Symon|away is now known as Symon
      • joespeakeasy joined the channel
      • jMyles has quit
      • gratimax is now known as gratimax|away
      • codeitloadit joined the channel
      • codeitloadit has quit
      • silverfix has quit
      • mabus44 has quit
      • stickperson has quit
      • sayan joined the channel
      • blipped joined the channel
      • gratimax|away is now known as gratimax
      • Frosh has quit
      • aarose joined the channel
      • tkimmel joined the channel
      • codeitloadit joined the channel
      • citadelgrad has quit
      • tkimmel has quit
      • aarose has quit
      • il
        ls
      • al1o has quit
      • HappyTom has left the channel
      • Frosh joined the channel
      • Tyriss has quit
      • Tyris joined the channel
      • codeitloadit has quit
      • mabus44 joined the channel
      • woltman has quit
      • natea has quit
      • juliaelman joined the channel
      • Delizin joined the channel
      • mstrcnvs joined the channel
      • Delizin
        Hey all. I am having some difficulty with a model form. Whenever I open the modelform's page, it appears to correctly load the model and instantiate the form, but it doesn't have any of the form data filled in. If I view it in debug, I can see the model has data in all the fields. I am using the same process on another page and it seems to work just fine. Not sure what I'm missing. https://dpaste.de/C1pf
      • quetzakubica joined the channel
      • yuwang joined the channel
      • robmorrissey has quit
      • joespeakeasy has quit
      • dray3 joined the channel
      • joshlegs
        Delizin: how are you rendering the form in your template?
      • oh wait. it might help if i read what you pasted first
      • Ariel_Calzada has quit
      • mattmcc
        Delizin: You're passing an empty request.POST to the form when the request method isn't POST.
      • LucSaffre joined the channel
      • joshlegs
        ^ yep
      • request.POST or None
      • mattmcc
        Well, it'll never have a value in that case, so just AgentForm(instance=agent)
      • Delizin
        Aha! Thank you guys. I knew it was something I had to be overlooking
      • joshlegs
        oh youre right
      • Delizin
        There is one other issue with that form. The inappropriately named PictureUrl field is actually an ImageField, but it doesn't seem to be updating properly.
      • eVRiAL has quit
      • moonkid has quit
      • mattmcc
        You're missing an enctype for the form.
      • Delizin
        There we go. Perfect. Thanks mattmcc
      • Cyph0n_ joined the channel
      • joshlegs
        ^ so many smart people in here. im thankful for them all.
      • jcdesimp joined the channel
      • ^ didnt mean for that to sound smartassy if it id
      • did*
      • Delizin
        Hmm I threw in enctype="multipart/form-data" in my form. I can see it sending the image properly, but it's still not being saved by the modelform
      • Forgetful_Lion has quit
      • mattmcc
        Oh, yeah, and you need to pass request.FILES to the form.
      • Delizin
        I suppose that makes sense heh
      • yuwang has quit
      • telex has quit
      • Much better. I am almost done with this project and eager to move onto my next
      • onizo joined the channel
      • joshlegs
        Delizin: awesome. is this your first django project?
      • il is now known as il_away
      • telex joined the channel
      • brandonw joined the channel
      • Delizin
        No, but it might still look like it. I had a huge project I finished a couple months ago. Everything works bug free on it, but my coding was terrible heh
      • joespeakeasy joined the channel
      • mstrcnvs has quit
      • I had an aversion to modelforms after a bad first experience and ended up doing all my forms by hand
      • and to make it worse I mixed tons of presentation code in my views instead of doing it in the templates
      • joshlegs
        hah. all code you wrote 6 months ago is bad code
      • mattmcc
        PHP background?
      • Delizin
        mattmcc: Not a huge one, but yes
      • jrist has quit
      • bdmc joined the channel
      • aarose joined the channel
      • Relaed joined the channel
      • sayan has quit
      • LysergicDreams has quit
      • codeitloadit joined the channel
      • codeitloadit has quit
      • aarose has quit
      • joespeakeasy has quit
      • bearish joined the channel
      • jbitcm- has quit
      • bearish has quit
      • OwlFace joined the channel
      • bwreilly joined the channel
      • OwlFace
        I'm getting IOError: decoder zip not available when I try to upload a jpeg
      • I have Pillow installed
      • I read on SO that I need to install zlib1g-dev and libjpeg-dev before installing PILLOW
      • does anyone know anything about that?
      • dray3 has quit
      • FunkyBob
        OwlFace: pillow relies on a number of C libraries to do the heavy lifting
      • if you have them installed, it will compilesupport for them
      • it's all shown in the output when you install pillow
      • if you don't have those -dev packages installed, it will just disable support for those formats
      • OwlFace
        okay
      • i'm going to try to install those two things
      • should I uninstall pillow first ?
      • Cyph0n_ has quit
      • FunkyBob
        you will need to reinstall pillow, yes
      • someone should redo pillow using ctypes
      • OwlFace
        i should sudo pip install zlib1g-dev right ?
      • FunkyBob
        right
      • this has the output I'm talking about -- http://prateekvjoshi.com/2014/04/19/how-to-inst...
      • look for : PIL 1.1.7 SETUP SUMMARY
      • OwlFace
        okay
      • when i sudo apt-get libjpeg-dev it says invalid operation libjpeg-dev
      • natea joined the channel
      • i installed zlib1g-dev already
      • bearish joined the channel
      • joespeakeasy joined the channel
      • joespeakeasy has quit
      • joshlegs
        ugh pillow
      • i *always* have issues with both that and PIL
      • OwlFace
        can i try installing one of these http://packages.ubuntu.com/precise/libjpeg-dev
      • instead
      • i don't know what else im supposed to do
      • ovnicraft joined the channel
      • natea has quit
      • Rouxi has quit
      • FunkyBob
        OwlFace: well, from the actual error you described I suspect it's a PNG with a .jpeg filename
      • however, you need to "apt-get install zlib1g-dev" ... loks like you forgot the "install"
      • OwlFace
        okay and i just reinstalled Pillow and it says JPEG support available
      • and a bunch of things that are not available like zlib freetype2 webp
      • but i dont know what any of those things are
      • FunkyBob
        well, png relies on zlib
      • robbyoconnor joined the channel
      • OwlFace
        you were right it was a png