Re: How to mock a model backend

2015-03-29 Thread Alejandro Varas G.
Hi Sven, You can mock the call to the external service like this. @mock.patch.object(MyModelBackend, 'authenticate') # First the class of your model backend. Then the method you want to mock. def test_something_that_uses_login(self, mock_authenticate): # The mock object is passed to your

Re: Config: DB or git?

2014-09-29 Thread Alejandro Varas G.
Hi Thomas, El 29/09/2014 10:05, "Thomas Güttler" escribió: > > Hi, > > of course we separate data from code: > > - code belongs into version control (git) > - data belongs into a database (postgres) > > But where does configuration belong? "To the environment" A good

Re: at django login my request.POST.get data are all empty, I struggle with what I missed there

2014-09-26 Thread Alejandro Varas G.
rs" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > T

Re: Best way to use a 'all' QuerySet as a dict with id first

2014-09-26 Thread Alejandro Varas G.
Hi, You should use User.objects.get(id=X) Best El 26/09/2014 15:28, "aRkadeFR" escribió: > > Hey! > > I'm having a hard time trying to reduce the number of SQL queries on a view. > > Basically, I'm fetching all my User, with User.objects.all(), and save this > queryset as