python - Django, where to import your modules -
i thought ok import of modules @ top of view file. if ever change model name can edit import @ top , not go digging through every view function need imported in.
well, ran instance had imported model @ top of view file, , used in function, reason django threw unbound variable error when tried use model query, leads me believe need imports each function?
so, question is, proper way it? import @ top of file or in each function needed.
thanks
there no requirement in django import modules @ function scope. can, true of python generally. i'd see code , error message. don't think problem due cause attribute to.
Comments
Post a Comment