I'm trying to create some models for my unit tests and I have a one to many relationship set up. When I try to create the 'many' models, I get a type error regarding the way I'm referencing the 'one' model, how can I amend my code so that it creates all models successfully?
Kayra: the __ lookup doesn't work for attributes, you need to use routine = Routine.objects.create(...); Exercise.objects.create(routine=routine, ...)
karanlyons
Kayra: You can't use double underscore kwargs in create statements, just in queryset work (querysets do some magic under the hood to build those relationships for you). You're also implicitly trying to create a routine inside of your statement to create an exercise. Try routine = Routine.objects.create(name='test1'); Exercise.objects.create(name='run', completion_time='0:01:00', position=5, routine=routine)
nimomo joined the channel
Technically .create() does return the object, so you *could* embed it into the call to Exercise.objects.create(), but that's not the most legible thing to do.
I'm trying to use apache2 (with two-way ssl auth-- it's working without django) but as soon as a I add the WSGIScriptAlias and Directory /path/to/my/app directives to my sites-enabled/000-default.conf and WSGIPythonPath to apache2.conf, I get 500 Internal Errors. Debug is set on.
ulhas joined the channel
Nevermind, I fixed it.
dszmaj has quit
ubuntu_aze has quit
josuebrunel joined the channel
digicyc has quit
falk0n has quit
ulhas has quit
nlh has quit
ulhas joined the channel
kyheo has quit
cramm has quit
TooLmaN has quit
contracode
knbk: do I drop that line into the project settings?
gaucho has quit
sheldo has quit
mihow joined the channel
grumpi has quit
Genitrust has quit
knbk
contracode: not sure if that works, but you can put it in AppConfig.ready()
NomadJim
are there any good django/python podcasts? haven't looked in a while
brat197 has quit
canton joined the channel
timograham
contracode: it won't work in settings, needs to be in AppConfig.ready()
I happened to create ticket the other day about documenting that #25999
knbk: timograham: should I get an instance of the offending site package's AppConfig and put it there?
knbk: timograham: I'm reading the Django docs on AppConfigs now... but I'm not seeing anything that sheds any light
JayFK_
/j pypa
whoops
hpanago joined the channel
timograham
I think ready() method should work
kalail joined the channel
SteenJobs joined the channel
knbk
contracode: if it has one, you can subclass it and point to your own subclass in installed_apps
scott_w has quit
nedbat
when running "manage.py migrate", I get a message about "The following content types are stale and need to be deleted", and it stops to get an answer from me. Can I prevent that?
ulhas has quit
codeme joined the channel
karanlyons
nedbat: yes | migrate?
knbk
nedbat: --noinput
contracode
knbk: it doesn't look like python-social-auth has them yet ;/
karanlyons
There's also --noinput, but I don't know if it answers yes or no.