What You Should Know About DRF, Part 3: Adding custom endpoints

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 with your @action decorator will automatically be rendered along with the other enpdoints.

Read More
What You Should Know About DRF, Part 2: Customizing built-in methods

If you came here from Part 1 of What You Should Know About Django REST Framework, you may be wondering why I just walked you through a bunch of source code. We stepped through that code because if you know what the main methods of the ModelViewSet do and how they work, you know where to go when you want to tweak the behavior of your viewset. You can pull out the method that contains what you want to change, override it with your own custom behavior, and put it back in. In Part 1, we were writing a BookViewSet. So let's go through a few cases where we might want to customize the behavior of our endpoints and walk through how we would do that.

Read More
What You Should Know About DRF, Part 1: ModelViewSet attributes and methods

One of the things I hear people say about Django is that it's a "batteries included" framework, and Django REST Framework is no different. One of the most powerful of these "batteries" is the ModelViewSet class, which is more of a "battery pack," in that it contains several different batteries. If you have any experience with Django's class-based views, then DRF's viewsets will hopefully look familiar to you.

Read More
Weeknotes: Squish all the bugs

In looking back over the PRs I submitted this week for my main client, who has a microservice architecture, I see that I was fixing a lot of small, annoying bugs.

These bugs were introduced as part of a rewrite I’m working on to improve the performance of a few API endpoints in one of the microservices. These endpoints depend on getting a lot of data from another microservice and we made some other changes recently that had the unexpected side effect of slowing these endpoints down quite a bit. I wound up making some pretty significant changes to how these endpoints get their data that involved also making some changes to the endpoints in the microservice it was calling, so it’s not surprising that there were some bugs to work out.

Read More
Five for Friyay: Useful Python and Django Libraries

Every day is a new adventure in a new job. I came into my job at REVSYS with not much production Python experience and my colleagues have been kind enough to share some time-saving and frustration-reducing libraries with me as I've been learning. This Friday, I'm sharing five libraries (technically, four libraries and a repo) that I've learned about in the last three months and fallen pretty much in love with. Enjoy!

Read More
Lacey Willliams Henschel
2017 Reviewed

In the spirit of starting 2018 off with a more confident step, however, I kept the focus on the results of the year, which were often beautiful, inspiring, funny, and joyful. Here's to a new year and a new 365 days of memories. 

Read More
Lacey Willliams Henschel
How does working remotely work?

Because I have worked remotely full-time for the past three years and it suits me pretty well, people ask me a lot about how working remotely works in practice. How did you get your boss on board? Do you really wear pajamas all day? What about loneliness? Read on.

Read More
Lacey Willliams Henschel