Using JavaScript’s Fetch with a REST API

If you are at all familiar with modern JavaScript, you have probably heard of, or used, Fetch; a function that allows you to make asynchronous HTTP requests. It leverages ES6 promises to make it easy to define asynchronous behavior. Fetch and promises can be tricky to work with and understand, especially if you are new to them. In this post, we will get a basic understanding of each of them, then discover how we can create a collection of wrappers to make sending requests to a traditional REST API a breeze.

Continue reading Using JavaScript’s Fetch with a REST API

Combining Inherited Django Forms in the Same FormView

This week, I discovered the power of Django’s generic editing views and was eager to try them out. I had two forms; one inheriting from the other. I could have them each in their own view, but for a better user experience, I wanted it all to happen on one page by allowing the user to toggle the extra fields. Today, I’m going to show you how to combine inherited forms or models in the same view with some Django magic and a little Javascript.

Continue reading Combining Inherited Django Forms in the Same FormView