Explore >> Select a destination


You are here

sobolevn.me
| | schinckel.net
2.2 parsecs away

Travel
| |
| | www.paepper.com
3.4 parsecs away

Travel
| | Unit testing your models in Django As a good developer, you write unit tests, of course. You will probably even write your tests before implementing your logic in a test-driven approach! However, when developing complex models which have interactions and foreign keys, writing tests can get messy and complicated. Say you want to test a model which has many dependencies to other models via foreign keys. To create an instance of your model, you first need to create all the other model instances which your m...
| | www.argpar.se
3.3 parsecs away

Travel
| | Get some handy tips for testing the django admin.
| | www.laceyhenschel.com
15.2 parsecs away

Travel
| Sometimes the endpoints you get when you use a ModelViewSet aren't enough and you need to add extra endpoints for custom functions. To do this, you could use the APIView class and add a custom route to your `urls.py` file, and that would work fine. But if you have a viewset already, and you feel like this new endpoint belongs with the other endpoints in your viewset, you can use DRF's @action decorator to add a custom endpoint. This means you don't have to change your urls.py -- the method you decorate w...