Skip to content

Task 5

Ahmed Hossam requested to merge Task-5 into main

Task

  1. Feel free to remove any non-API views that we created from before
  2. Create a class-based view at the path /artists/ that returns a list of artists in JSON format for GET requests, the artist data should include the following fields.
{
    "id": ...
    "stage_name": ...
    "social_link": ...
}
  1. The same view above should accept POST requests and accept all the fields on the artist model (excluding the id)
    • Include proper validation for each field as listed on the artist model:
      • this field is required
      • this field value already exists (for unique fields)
    • If the request passes the validation process, the given data should be used to create and save an artist instance
  2. You may want to use a tool to make the HTTP requests and inspect them, I personally use Postman but there are other options like curl and Insomnia
  3. Feel free to write the API views yourself or use DRF's generic views.
  4. Feel free to write the serializers yourself or use DRF's ModelSerializer
Edited by Ahmed Hossam

Merge request reports

Loading