Not all applications work with a read-only API. Sometimes, you want full CRUD support from your API. You need to add an authentication step before you make this functionality available. Fortunately, Tastypie does all of this for us.
- [Teacher] We've built a read-only API,…but many would also like to have…what is commonly referred to as CRUD Support.…This is an API that allows creating, reading,…updating, and deleting of data.…This isn't too hard, but we need to be extra cautious,…because we don't want just anyone to have this capability.…We're also going to need authentication support.…Tastypie offers several authentication methods.…If you're simply creating single-page apps…with AngularJS or similar,…you can probably use session authentication,…which works just like your standard HTML apps.…If you're simply creating single-page apps…with AngularJS or similar,…you can probably use session authentication,…which works just like your standard HTML apps.…
However, if your API will be accessed…by mobile apps or other servers,…you'll want to use key-based authentications.…We'll create a mixin that adds the support we need.…First in our API, we need to import ApiKeyAuthentication…and DjangoAuthorization.…Then we'll create our mixin class.…You'll see this isn't too complicated, which is nice…
Django is one of the world's leading web development platforms. This Python web framework makes your app building experience smoother, faster, and easier. It is a key feature behind the success of many start-ups across the world, including Instagram and Nextdoor. This course introduces next-level advanced concepts to help you build your own professional-grade Django applications.
Author Kevin Veroneau starts off by explaining how class-based views—a powerful, but often poorly understood feature—work in Django. Then learn how to create custom middleware to help organize frequently used code. Have you ever wanted to build a complete RESTful API? Find out how to do just that, starting with a basic read-only API and then adding key-based authentication to allow the full range of CRUD functionality. Plus, discover how to use model managers and the Q method to make it easier to get the data we need to our views and clients.
For the finishing touches, dive into the details of caching to improve application performance, and then add custom management commands to help automate routine tasks.
- Extending class-based views
- Creating custom class-based views
- Managing your database with middleware
- Creating template filters and tags
- Building a RESTful API
- Modeling advanced database relationships and queries
- Using a model manager for your application