These are chat archives for django/django

12th
Feb 2016
Bernard Parah
@b3h3rkz
Feb 12 2016 07:43
Please how do I go about overriding the python files in a third party app. I am comfortable with how to override templates though. Thing is for example, I have this third party app that requires a user to be logged-in before they can view certain pages, I do not want the same thing. So I checked the views.py of the app in site-packages(using virtualevn here) and saw the "LoginRequiredMixin" been inherited by that view. from my own little understanding, I think removing that class will solve the issue, but then when running the project in a different environment, the requirements.txt will have to install it again and then back to normal. How to I go about doing this and making sure it stays as I want regardless of the environment?
Pramod Maurya
@pramodmauryaiiita
Feb 12 2016 08:36
hi, all
please suggest some good articles on testing apis in django using python mock..., as I don't want to use db calls to be made
looking forward to it
Vladimir Shulyak
@vshulyak
Feb 12 2016 08:47
@pramodmauryaiiita The approach we used is testing serializers in unit-test fasion. I believe that if you you mock manager calls while running integrational tests that would cause a lot of trouble later on and make your testing suite fragile. So we just accepted the fact that we need to unit-test small bits of code and try to avoid integrational tests at all. Sorry, no links to articles...
Pramod Maurya
@pramodmauryaiiita
Feb 12 2016 09:02
ok, got it, but python unittesting makes a temp database, that will take huge amount of time, how can I get over it
Vladimir Shulyak
@vshulyak
Feb 12 2016 09:04
@pramodmauryaiiita you don't need a temporary database to do unit-testing. Take a look at https://github.com/gabrielfalcao/unclebob#warning (a little bit outdated, but anyway)
Pramod Maurya
@pramodmauryaiiita
Feb 12 2016 09:11
thanks
Kaoua Cherif
@kawache
Feb 12 2016 09:14
Hello all, can you tell the version of Django on which django-nonrel is based, i can't find this anywhere.
Filip Figiel
@megapctr
Feb 12 2016 09:46
hello django community!
I noticed a strange thing with Froms and initial values for fields
say I have an IntegerField(initial=1, required=False)
then in clean_field I do:
return self.cleaned_data.get('field') or self.initial['field']
a KeyError is thrown, and when I inspect self.initial it turns out to be an empty dict
this looks like a bug to me