Python/Django notes from a Ruby/Rails Developer
Posted on May 26, 2019
Tags: python, django, rails, ruby, programming
So, recently I starting working with Python/Django, come from a Ruby/Rails background, I decide keep notes about some points. So here we go:
NOTE: I will keep this post updated as I figure out new things.
- Use
pk
instead ofid
Some models don’t follow the rule of use id
as the primary key. So always use .pk
in order to get the correct primary key
Run single test case:
./manage.py test app.tests.test_helper
Tests: mocks
Inform the path from where the method is called. In this case, the method foo_bar
is used inside the my_app
helper.
If is a object related method, use:
You can also use return_value
if you need
- Refresh object from DB