#django

/

      • softinio joined the channel
      • amikiri joined the channel
      • NCS_One has quit
      • ramblingpirate
        mattmcc: Thanks, that worked. Now I just have to figure out how to get the input boxes in the table as well.
      • ralph4100 joined the channel
      • ralph4100
        I'm pulling my hair out with an error "local variable 'l_counts' referenced before assignment" - there is no variable referenced by that name anywhere in the code!
      • anyone have an idea of how this could happen
      • stahl has quit
      • mattmcc
        ramblingpirate: Just render the choice.
      • E.g, {% for choice in form.choicefield %}{{ choice }}
      • ralph4100: The traceback will point you to its location.
      • ralph4100
        mattmcc, yes - but traceback does not have any lines that have that in it
      • mattmcc
        The bottom line is the relevant one.
      • ciurkut has quit
      • ralph4100
        mattmcc, with respect - I have successfully followed the traceback to 1000s of errors
      • ciurkut joined the channel
      • mattmcc
        So you know that it's unlikely that Python is lying to you, then.
      • eVRiAL has quit
      • eVRiAL_ joined the channel
      • kenbolton joined the channel
      • ralph4100
        mattmcc, very occasionally the traceback obscures something
      • I've had a handful of pretty bewildering traceback instances ... so just checking if anyone experienced something like this before
      • mattmcc
        I've usually found bare except's to be a culprit in those cases.
      • ramblingpirate
        mattmcc: this is happening now: http://imgur.com/m0YjjwE here's the code: https://dpaste.de/ofL5
      • eka has quit
      • ciurkut has quit
      • eVRiAL_ has quit
      • ralph4100
        I just discovered pdb recently - is there a way to run runserver with that so I can check out where this happens?
      • would I do python -m pdb manage.py runserver?
      • drag0nius
        i'm pretty sure it's possible, but don't remember how
      • mattmcc
      • drag0nius
        that too
      • runserver_plus + debug toolbar and you rarely need debugger
      • dmclain has quit
      • coot has quit
      • havingFun_ joined the channel
      • Methodical has quit
      • havingFun has quit
      • softinio_ joined the channel
      • softinio has quit
      • ralph4100
        mattmcc, thank you - this is incredible. will help tons in future. now I was able to reproduce error from calling a line several steps up in traceback ... and it cites an error on line 107 from a file that is 51 lines long
      • (!)
      • Blizzy joined the channel
      • eka joined the channel
      • HowardwLo joined the channel
      • dyl joined the channel
      • softinio_ has quit
      • jarshwah joined the channel
      • oncallsucks has quit
      • kenbolton has quit
      • Tr0p1caL has quit
      • Methodical joined the channel
      • kenbolton joined the channel
      • stahl joined the channel
      • Goopyo joined the channel
      • the code in question is a jinja2 macro ... if I put it in its own file, the error stops. i'm going to chalk this up to a jinja2/coffin/dark underbelly of using a separate templating system and move on
      • but be warned - you can find yourself in a kafkaesque traceback nightmare that will leave you questioning the sanctity of the traceback
      • FunkyBob
        or questioning why you bothered with jinja in the first place :P
      • ralph4100
        hopefully things are better once django adopts real support for other templating systems
      • Funkybob - from our convo the other day ... and this is not an actual reason for choosing to use it as the question will show
      • FunkyBob
        but I do wonder... what is it drove/drew you to jinja?
      • dyl has quit
      • ralph4100
        but w/ django templates - can you do macros? that is an awesome funcationality (when it works) that i use a lot
      • FunkyBob
        django-sniplates lets you do macros
      • ralph4100
        ok ... I'll check out
      • drag0nius has quit
      • FunkyBob
        lets you pull in a number of other templates, and their blocks become macros
      • ralph4100
        way back when I made the decision it was so I could do python code that I now would have easily been able to put in a model method
      • mattmcc
        The tag shortcuts also make life easier (inclusion, simple, assignment)
      • FunkyBob
        yeah, very rarely have I found anyone with a legitemate reason for switching to jinja
      • mattmcc
        None of those existed when jinja2 was created, iirc.
      • ralph4100
        I will say - I prefer (and this is just an opinion) the syntax of jinja, since it's like regular python
      • vs the no parenthesis stuff in django template language
      • mattmcc
        Yeah, that'll always be a matter of preference, and target audience.
      • The vast majority of the templates written for my apps are written by a non-programmer, he'd be lost in jinja.
      • FunkyBob
        ralph4100: and you want all your front-end people to learn Python?
      • ralph4100
        FunkyBob, yes ... my legions of "font end people" ... ie me
      • FunkyBob
        :P
      • ralph4100
        lol
      • I will let you know the day I have front end people - and give a thank you to the django irc
      • dheerajchand has quit
      • StarFishCat joined the channel
      • kenbolton has quit
      • StarFishCat
        Hi i know this is a bit spammy and rude but I am a really new producer trying to spread my music, All my music is free for DJs to use, give a listen and I really hope you enjoy my music (: https://soundcloud.com/303minx/god-damn-right
      • Methodical has left the channel
      • Fedor joined the channel
      • Fedor has left the channel
      • amikiri has quit
      • josephleon has quit
      • dyl joined the channel
      • dyl has quit
      • vincenttide joined the channel
      • ramblingpirate
        mattmcc: Okay, so figured out what was wrong with that picture. But i still can't get this stupid thing to render inside the table body like it's supposed to.
      • technically, it's not even inside the table.
      • bkolden joined the channel
      • dyl joined the channel
      • exaroth joined the channel
      • daniel3 has quit
      • tyrion-mx has quit
      • mattmcc
        ramblingpirate: Well, what does your form & choice field look like?
      • ramblingpirate
        I'll paste it hold on
      • josephleon joined the channel
      • daniel3 joined the channel
      • x100s_ has left the channel
      • mattmcc: I was using the checkboxmultipleselect widget, and that was rendering fine, except that the checkboxes were outside the table.
      • mattmcc
        Ah, okay. What I've done in the past is let label stay just a label, but (and this is a hack) setattr(label, obj)
      • ramblingpirate
        in the form class, you mean?
      • exaroth has quit
      • jlmitch5dev has quit
      • I'll be honest, I'm not following. This is the first time I've ever had to subclass anything in django. It's usually had exactly what I wanted.
      • txomon|home has quit
      • josephleon has quit
      • toothe
        when is a function considered "Too long" and needs to be broken into several functions?
      • assuming that the function's objective is singular.
      • Debnet has quit
      • dyl has quit
      • slmb has quit
      • daniel3 has quit
      • yeukhon joined the channel
      • josephleon joined the channel
      • schinckel
        toothe: I use PEP8/flake8, and it does complexity calculations. I think I aim for 8, but will let it get to 10.
      • toothe: McCabe complexity, that is.
      • Ariel_Calzada joined the channel
      • Another way is if it no longer fits on the screen at once, it's too long.
      • But, sometimes it's hard to logically break stuff up.
      • josephleon has quit
      • adamsilver has quit
      • dmclain joined the channel
      • toothe
        you aim for 8 what?
      • oh, im not famliar with the term McCabe complexity.
      • k_sze[work] joined the channel
      • dmclain has quit
      • jondbaker joined the channel
      • dump has quit
      • samdead has quit
      • amikiri joined the channel
      • Tau joined the channel
      • SmileyChris
        ramblingpirate: how you coming along?
      • ramblingpirate
        SmileyChris: Miserably. I figured out I could override the render function on CheckboxSelectMultiple, and just return the output with .replace() whatever. But I still can't get it in a friggin' table.
      • jlmitch5dev joined the channel
      • SmileyChris
        ramblingpirate: what Django version are you on?
      • ramblingpirate
        1.7.1
      • Tau has quit
      • And I've googled my brains out. I'm sure there's an app somewhere that does just what I want. I just want a checkbox in a table row. WHY AM I DUMB
      • SmileyChris
        ramblingpirate: ok, I think what you're going to have to do is create a custom ChoiceFieldRenderer and widget
      • the renderer handles the choice iteration
      • ramblingpirate
        SmileyChris: okay. Would you mind giving me a broad overview of what needs to happen in a renderer?
      • Like, i know I can just super() and then override, right?