These are chat archives for django/django

22nd
Jun 2016
Jared Mackey
@mackeyja92
Jun 22 2016 01:09
Does testing in Django set a specific setting to True? Like TESTING? I need to do some stuff differently when testing
Filip Figiel
@megapctr
Jun 22 2016 04:55
Pytest django provides a settings fixture, it allows you to overwrite settings for certain tests
Unless you want to have a global test settings, in this case you can have a separate settings file for testing
mpachas
@mpachas
Jun 22 2016 05:30
@mackeyja92 you can do it yourself, write TESTING = True in your only-for-test settings file. And you may need to write TESTING = False in the others, so it does always find the key.
webscrapy-expert
@webscrapy-expert
Jun 22 2016 15:58
hello, everyone. I would like to get the lenght of split in django template without any define the template tag. is it possible?
Filip Figiel
@megapctr
Jun 22 2016 17:21
No
Nathan Nichols
@nqthqn
Jun 22 2016 17:52
How does Django generate html forms with initial data?
I want to implement this myself - combine a html form text with initial values. Will I need to use beautiful soup or something
Filip Figiel
@megapctr
Jun 22 2016 18:31
Check out crispy forms, maybe you don't need to generate them manually
For the generation code, you can simply check out django source code
Nathan Nichols
@nqthqn
Jun 22 2016 18:32
I was using that before
@megapctr this is what I have so far...
from pyquery import PyQuery as pq

def populate_html_form(data, html_form):
    d = pq(html_form)
    d = pq(html)
    for key,value in data:
        d('[name={0}]'.format(key)).val(value)
    return d.html()
Filip Figiel
@megapctr
Jun 22 2016 18:32
Okay. Django has a set of functions for generating html markup
Nathan Nichols
@nqthqn
Jun 22 2016 18:33
I've got user defined forms that i need to support
so a string of html form... then i need to use this as a form for particular users
saving data as key value pairs
now I am trying to generate a csrfmiddlewaretoken in the view since the raw html will not have any tags ({% csrf_token %})
i think this will do it
cburgdorfer
@cburgdorfer
Jun 22 2016 18:54
Hi, where is the best place to find django contractors in london?