#django

/

      • webscrapper1
        hey funkybob can you break down twitter bootstrap into one sentence. What is it and whats its purpse?
      • quantik
        making your frontend beautiful and easy
      • foist joined the channel
      • felixsamora has quit
      • nicholasserra has quit
      • foist has quit
      • hyperair joined the channel
      • furoido has quit
      • johtso has quit
      • foist joined the channel
      • moneydouble
        I have a very simple model, https://dpaste.de/kpf1 - when I do {{ user.user_questions_values }} I see the relationship manager… how can I get the value? There can be multiple records in UserQuestionsValues for this.
      • aliona_ has quit
      • furoido joined the channel
      • johnb25
        moneydouble: since user_questions_values can be many, you need a loop
      • schinckel
        {% for obj in user.user_questions.values.all %}
      • johnb25
        ^
      • twoolie has quit
      • lVathan_ has quit
      • foist has quit
      • schinckel
        Oops, user_questions_values
      • lVathan
        exit
      • lVathan has quit
      • johnb25
        then inside the for loop you can do obj.value
      • hwrd|work joined the channel
      • moneydouble
        ahh right, I forgot the .all part lol I knew I had it right
      • The models
      • LightScry
      • garrypolley joined the channel
      • moneydouble
        Thanks schinckel johnb25
      • johnb25
        no worries
      • notori0us is now known as czl
      • czl is now known as notori0us
      • terminalRepeat has quit
      • heedly joined the channel
      • webscrapper1
        whats the best way to capture the data from a submitted form and post it to database?
      • Leeds has quit
      • mattmcc
        A ModelForm?
      • garrypolley has quit
      • ecksile
        just build the form to pass it to the correct view
      • FunkyBob
        webscrapper1: I did mention you should go read the "Forms for models" docs
      • ecksile
        and then grab the form data from the request variable
      • well for the form to post the data the correct url, which is linked to the correct view, and then grab the request.POST['formid']
      • or whatever the syntax is
      • mattmcc
        ...Or use a ModelForm.
      • fission6 has quit
      • Fuyou
        Or a generic view ?
      • moneydouble
        johnb25, schinckel - maybe I'm still half asleep but I feel like I should know this… how would I get the question name? If I have this: {% for obj in user.user_questions_values.all %} how do I get the UserQuestions model.name? {% endfor %}
      • FunkyBob
        webscrapper1: use a ModelForm
      • moneydouble
        {{ obj.userquestions.name }} doesn't work
      • webscrapper1
        ok
      • mattmcc
        moneydouble: You named your FK 'question'
      • ecksile
        modelform seems like a lot of work if this is a one off
      • moneydouble
        mattmcc: oh duh lol, I was trying to get another relationship vs the field.
      • Thanks
      • johnb25
        moneydouble: you should take a rest :)
      • hehe
      • webscrapper1
        ill be back tomrrow funkybob thanks for the guidance
      • mattmcc
        Who's assuming it's a one-off? And assuming a model exists (Which is the typical way to put things in databases with Django) then a ModelForm would be less work than manually moving the data from request.POST to the model object for saving.
      • moneydouble
        johnb25: lol yeah I didn't sleep last night and took a 30 min nap :P
      • foxx[cleeming] has quit
      • ecksile
        hmm, true
      • bkuberek has quit
      • ezekielnoob has quit
      • that makes sense, i kind of glossed over the fact that it automatically saves the record
      • k_sze[work]
        Strange. We are using a MySQL backend for one of our projects. Somehow some of the new tables get varchar fields created with the latin1_swedish_ci collation whereas all the old tables are in utf8_unicode_ci.
      • FunkyBob
        k_sze[work]: serves you right for using mysql :P
      • isn't the swedish collation default for mysql?
      • k_sze[work]
        FunkyBob: legacy PHP app ported to Django.
      • we haven't had the time to move everything to PostgreSQL yet.
      • FunkyBob
        at least it's on the cards :)
      • k_sze[work]
        (so I hope)
      • joshfinnie joined the channel
      • MySQL is horrible.
      • chuckharmston has quit
      • FunkyBob
        I had to help some colleages tune an app using it the other day
      • k_sze[work]
        still
      • FunkyBob
        it's not only stupid and slow, but it also makes it hard to tune
      • hwrd|work has quit
      • k_sze[work]
        the other newish tables created by Django are all utf8_unicode_ci. I don't know what happened to cause the latest ones to be created as latin1_swedish_ci.
      • schinckel
        Could be worse. They could be encoded as utf8_swedish_chef
      • bork! bork!
      • k_sze[work]
        utf8_klingon_kli
      • gazumps has quit
      • schinckel watches "Swedish chef: Swedish meatballs"
      • gazumps joined the channel
      • buzinator has quit
      • theskumar has quit
      • BlueDreams has quit
      • twoolie joined the channel
      • Siecje has left the channel
      • hejirarijeh joined the channel
      • restless_being has quit
      • hejirarijeh
        Hi all. Trying to create a model with a django.contrib.gis.db PointField in a second database. The second database, "geo," is using django.contrib.gis.db.backends.postgis
      • theskumar joined the channel
      • … my default db uses django.db.backends.postgresql_psycog2. I have a router set up, but when I run ./manage.py sqlall geoapp I get "AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'" — implying that sqall tried to use the default db instead of my specified db in the router. Very tough problem
      • basti-mbp joined the channel
      • Any thoughts? I'll post my router
      • SmileyChris has quit
      • ryborg joined the channel
      • BlueDreams joined the channel
      • Derimagia joined the channel
      • BTW I am running django 1.5.1
      • FunkyBob
        hejirarijeh: did you check the release notes for django 1.5.2 through 1.5.5 ?
      • hejirarijeh
        No not yet, is there some stuff on this?
      • FunkyBob
        not sure... worth a look
      • basti-mbp has quit
      • hejirarijeh
        So, btw, I am using the same syntax for the router regarding allow_syncdb as the 1.5 docs (https://docs.djangoproject.com/en/1.5/topics/db...). But yes, let me take a closer look at the release notes.
      • gazumps has quit
      • gazumps joined the channel
      • Just paged through the 1.5.2->1.5.5 release notes. No mention of routers or syncdb.
      • robbyoconnor joined the channel
      • It just really seems to me there is something wrong either with my understanding of routers or the way that django is processing my router. I only have one router, and it seems to me that my logic enforces that syncdb cannot be called using the default db. My router is also in my settings.py file. If I place a "raise" in my router between lines 19 and 21, an error is never raised.
      • (if i put a raise between lines 21 and 23 an error is raised)
      • (raised when I call "/manage.py sqlall geoapp" as mentioned above)
      • hwrd|work joined the channel
      • Ok. So maybe the deal is I just need to run "./manage sqlall geoapp --database=geo" … this seems to work.. I guess that if not database is hinted, then default is used and allow_syncdb never results to geoapp
      • Okay, this makes sense… now to try to figure out how to get this to work with south
      • (WELL! Sort of makes sense. Not sure why django even gets to the error… it seems to me that app_label will always be geo app so returns false on allow_syncb.. weird)
      • liwen has quit
      • hwrd|work has quit
      • cyong joined the channel
      • cyong has quit
      • cyong joined the channel
      • Yup. South is broken on this. blargghhh. Oh, well.
      • leomark joined the channel
      • LysergicDreams has quit
      • robvdl has quit
      • LysergicDreams joined the channel
      • Anyone know how I can go about getting a little more help with this router issue? I've run into something similar (with sqlite3—stuff ending up in the default db when it doesn't seem like it is the right place) with the router. I'm wondering if it even could be a bug, as unlikely as it may sound.
      • LysergicDreams has quit
      • leomark_ joined the channel
      • leomark_ has quit
      • sohail has quit
      • zerick has quit
      • leomark has quit
      • JulianGindi joined the channel
      • mykul has quit
      • gazumps has quit
      • arkore has quit
      • bojo__ joined the channel
      • garrypolley joined the channel
      • mribeirodantas has quit
      • bojo_ has quit
      • arkore joined the channel
      • garrypolley has quit
      • mun joined the channel
      • zauberpony has quit
      • zauberpony joined the channel
      • canibanoglu joined the channel