These are chat archives for django/django

17th
Jul 2018
Christopher Sabater Cordero
@cs-cordero
Jul 17 2018 01:57
For an HttpRequest is it possible for HttpRequest.GET to have data when the request.method == 'POST'?
Curtis Maloney
@funkybob
Jul 17 2018 01:59
yes
Christopher Sabater Cordero
@cs-cordero
Jul 17 2018 01:59
how does that happen?
Curtis Maloney
@funkybob
Jul 17 2018 01:59
it's somewhat poorly named, in truth... those values come from the query string in the URL
so if you POST to a url that has ?key=value&.... it will have data in request.GET
Christopher Sabater Cordero
@cs-cordero
Jul 17 2018 02:00
ah, gotcha
thanks
Elijah Rippeth
@erip
Jul 17 2018 11:50
Hi folks. I'm pretty new to django and I'm finding it kind of difficult to separate my app's behavior between test, dev, and prod. We're using django-oidc for auth against a corporate OpenID server in prod, but I don't want to use this in dev... but it seems like there's no way to completely disable authentication in development?
Curtis Maloney
@funkybob
Jul 17 2018 11:52
mock
actually, in the test docs they do show how you can forcibly log in the test client, instead of going through login
Elijah Rippeth
@erip
Jul 17 2018 11:56
Mocking is development mode?
Elijah Rippeth
@erip
Jul 17 2018 11:56
Not sure how that could even be done without some pre-run fixture
Curtis Maloney
@funkybob
Jul 17 2018 11:57
from unittest import mock .... it will let you mock calls to the OIDC server
Elijah Rippeth
@erip
Jul 17 2018 11:58
Yes, this works well when you're testing, but not when you're running in development
Curtis Maloney
@funkybob
Jul 17 2018 11:58
ah, sorry, misread...
do you have a test env for the OIDC server?
I'd be using something like django-classy-settings to make it easy to switch out settings for different envs
Elijah Rippeth
@erip
Jul 17 2018 11:59
Good question -- not sure. I would prefer to not rely on that if I could.
I'm using django-configurations to create various Settings for dev, prod, test, staging, etc. And I find that if I put my auth-specific settings only in prod, I get a lot of attribute errors with OIDC
Frustratingly tightly coupled
Curtis Maloney
@funkybob
Jul 17 2018 12:01
yeah, I didn't like it... part of why I wrote django-classy-settings :)
Elijah Rippeth
@erip
Jul 17 2018 12:03
Heh, I meant django in general... but maybe the app I inherited was just written that way.
Nathan Kirui
@Nkirui
Jul 17 2018 18:17
hellos guys..
created_on = models.DateTimeField(auto_now_add=True)
last_modified = models.DateTimeField(auto_now=True)
created_by = models.ForeignKey(settings.AUTH_USER_MODEL,on_delete=models.CASCADE,default='')
i have a crude application and there are several staff users who logged in and make changes ..so added the last field as shown above but am not getting any success ..do anyone of you know of how i can go about?..thanks.