Momentum logo
Team 10 Classroom

๐Ÿป Token Authentication and CORS ๐Ÿป

Posted on Dec 13th, 2021

Todayโ€™s Topics

  • Token authentication in DRF with Djoser
  • CORS headers

๐ŸŽฏ Collaborative Project

Kick it into gear! You should have the basics of your CRUD functionality by tomorrow.

๐Ÿ“– Read | ๐Ÿ“บ Watch | ๐ŸŽง Listen

  • Finally Understand auth in DRF - a Will Vincent talk -> Will isnโ€™t using the Djoser library but he does a great job of reviewing different auth strategies and why you would choose one or the other. Watch this for a better understanding and overview of auth.

๐Ÿ”– Resources

Authentication

CORS

Permissions

๐Ÿฆ‰ Code

๐ŸฆŠ Deploying a React Application ๐ŸฆŠ

Posted on Dec 9th, 2021

Todayโ€™s topics

  • React Trivia progress
  • Organizing your code
  • Deploying to Netlify

๐ŸŽฏ Project

The React Trivia application is due on Monday โ€“ that means it meets at least the minimum functional requirements and is deployed to Netlify ๐Ÿš€.

Minimum functional requirements:

  • A user can see a list of categories.
  • A user can select one category.
  • A user can see a list of questions for that category, with answer options for each question.
  • A user can select an answer for a question.
  • A user can see if that answer is the correct answer.

It would be awesome if:

  • The answers are shuffled so that the correct answer is not always in the same position.
  • A user can see how many questions they answered correctly (or some kind of score) when they have answered all the questions in a category.

๐Ÿ“– Read | ๐Ÿ“บ Watch | ๐ŸŽง Listen

๐Ÿ”– Resources

๐Ÿป Views and Serializers in DRF ๐Ÿป

Posted on Dec 9th, 2021

๐Ÿ—“๏ธ Todayโ€™s Topics

  • Views and viewsets
  • Nesting and customizing serializers
  • Permissions

๐ŸŽฏ Project

Keep on with your API building ๐Ÿ’ช! What do you need to know to get it working?

By today or tomorrow your app should respond with json to a request for all habits/books, for one habit/book, and for one book/habitโ€™s associated objects (daily records for habits; reviews or trackers for books).

๐Ÿ”– Resources

๐Ÿฆ‰ Code

๐ŸฆŠ Multiple components and conditional rendering ๐ŸฆŠ

Posted on Dec 7th, 2021

๐Ÿ—“๏ธ Todayโ€™s Topics

  • Troubleshooting AJAX requests and getting data on the page
  • Using multiple components and conditional rendering to create multiple views of your application

๐ŸŽฏ Project

Continue React Trivia. Remember to take it step by step! Donโ€™t try to do too much at once.

For Thursday, make your trivia categories selectable. When selected, you should show at least 10 questions for that category.

If you can get that working, the next step is to show answers and perhaps even make them selectable.

๐Ÿ”– Resources

๐Ÿป Django REST Framework ๐Ÿป

Posted on Dec 7th, 2021

๐Ÿ—“๏ธ Todayโ€™s Topics

Today we dive into Django REST Framework. ๐ŸŠโ€โ™‚๏ธ

๐ŸŽฏ Project: Choose Your Own Adventure

The application must be deployed to Heroku, whichever option you choose. ๐Ÿš€


๐Ÿช OPTION ONE: Add an API to Habit Tracker

Add a new app to your existing Habit Tracker project and call it api. Your app should provide CRUD endpoints that return JSON responses.

By Friday afternoon, you should be able to do the following via the API โ€“ that is, by making requests using Insomnia.

  • list habits
  • create a new habit
  • view a habit
  • update a habit
  • delete a habit

By Monday, you should be able to complete all CRUD tasks through the API:

  • list habits
  • create a new habit
  • view a habit
  • update a habit
  • delete a habit
  • list records for a habit (this should be on the habit detail API endpoint)
  • create a record for a habit
  • update a record for a habit
  • delete a record from a habit

Write up a list of endpoints you think you will need before you start doing this!

You should develop and test your endpoints using Insomnia. (You can also use the browsable API that DRF gives you in the browser, but you should be comfortable using Insomnia.)

๐Ÿซ OPTION TWO: Django Library API

Link to assignment invitation. Note, this is an empty repo, so you wonโ€™t have to delete a README to start.

Create a new API-only application that lets users keep track of their books, including important information like title, author, publication date, a field that marks it as โ€œfeaturedโ€, and maybe other fields like โ€œgenreโ€ if you want. Books should be unique by title and author (that is, you canโ€™t have two books with the same title and author; two books with the same title is fine as long as the authors are different).

Anyone can add a new book as long as the same book is not already in the library. Only admin users can update book details and delete books.

Youโ€™ll also need a book tracking model so that users can mark a book as โ€œwant to readโ€, โ€œreadingโ€, or โ€œread/doneโ€. Users can also write reviews on books, which should be viewable to all users. Optionally users can take private notes on books.

You should not make forms or templates for this app, but you will need models, urls, views, and serializers. You should use class-based views and return JSON responses.

Your app should allow users to:

  • list all books
  • list all featured books
  • create a book
  • retrieve details about a book
  • mark a book as want to read, reading, or read
  • retrieve all reviews for a book
  • post a review for a book
  • edit their own review (not delete it)

Admin users can:

  • update a book
  • mark a book as featured
  • delete a book
  • delete reviews

๐Ÿ“– Read | ๐Ÿ“บ Watch | ๐ŸŽง Listen

๐Ÿ”– Resources

Blog articles that go with Lacey Williams Henschelโ€™s talk

๐Ÿฆ‰ Code