Re: mocking out a Model

2012-04-15 Thread HarpB
I would recommend that you don't use the patch decorator, but rather the patch function itself. Here is a wrapper function I used when patching classes and functions (assuming you are using TestCase class): def patch(self, *args): if len(args) == 2: patcher = patch.object(

Re: basci question about queryset for retrieving top element

2012-04-16 Thread HarpB
Both patterns will produce same query. You can also use django-debug-toolbar, which gives ur debugsqlshell tool. So you can execute code from the commandline and can see what the query will be. Django also has a code pattern for your case - for getting the first element, you can just use latest

Re: basci question about queryset for retrieving top element

2012-04-17 Thread HarpB
Like this http://readthedocs.org/docs/django/en/latest/py-modindex.html?highlight=django or perhaps this http://djangoapi.quamquam.org/trunk/ ? There is also a great book: http://www.djangobook.com/en/2.0/ -- You received this message because you are subscribed to the Google Groups "Django us

Re: keep models simple ? where to put the business logic ?

2012-04-28 Thread HarpB
First of all, I think your function is too big if it is doing all of these things. Are you able to unit test the function? In my view, the logic for extract should not be in the model. I would create a class specifically for data extractions. I am assuming that the _store does not DB saves to

Re: html5 + Django

2012-04-30 Thread HarpB
It is much better to use Apache for static files than Django. You can still run DJango for data validation, but all static content is typically served via Apache. In your virtualhost, you should proxy the /static/ endpoint to the /static/ folder in Django app. On Sunday, April 29, 2012 5:39:15

Re: How would I go about building an API converter?

2012-05-02 Thread HarpB
I am a big fan of TastyPie. But I don't understand your following requirement: - *Get/set (conversion) between different schemas* - I.e.: No matter the input API, you can get it formatted in whichever output API you request Are you simply trying to create a unified interface