These are chat archives for django/django

17th
Jul 2018
Christopher Sabater Cordero
@cs-cordero
Jul 17 2018 01:57 UTC
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 UTC
yes
Christopher Sabater Cordero
@cs-cordero
Jul 17 2018 01:59 UTC
how does that happen?
Curtis Maloney
@funkybob
Jul 17 2018 01:59 UTC
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 UTC
ah, gotcha
thanks
Elijah Rippeth
@erip
Jul 17 2018 11:50 UTC
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 UTC
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 UTC
Mocking is development mode?
Elijah Rippeth
@erip
Jul 17 2018 11:56 UTC
Not sure how that could even be done without some pre-run fixture
Curtis Maloney
@funkybob
Jul 17 2018 11:57 UTC
from unittest import mock .... it will let you mock calls to the OIDC server
Elijah Rippeth
@erip
Jul 17 2018 11:58 UTC
Yes, this works well when you're testing, but not when you're running in development
Curtis Maloney
@funkybob
Jul 17 2018 11:58 UTC
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 UTC
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 UTC
yeah, I didn't like it... part of why I wrote django-classy-settings :)
Elijah Rippeth
@erip
Jul 17 2018 12:03 UTC
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 UTC
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.