Coder Social home page Coder Social logo

py-api-views's Introduction

API Views

Now, you are going to implement views via class-based views.

Create Genre, Actor, CinemaHall models and update Movie model to the ones you wrote in Django ORM module. Modules should have such fields:

  • Actor: first_name, last_name
  • Genre: name (note: must be unique)
  • CinemaHall: name, rows, seats_in_row
  • Movie: title, description, actors, genres, duration. (note: you already have a new field here)

Create serializers for all these models. Do not use related serializers for ManyToMany relations.

Create views for models interaction endpoints via different class-based views:

  • For the Genre model use an APIView
  • For the Actor model use a GenericAPIView
  • For the CinemaHall model use a GenericViewSet
  • For the Movie model use a ModelViewSet and routers

For every <entity> from actors, genres, cinema_halls, movies, such endpoints should work:

  • GET api/cinema/<entity>/ - should return a list of the all entity items
  • POST api/cinema/<entity>/ - should create a new entity based on passed data
  • GET api/cinema/<entity>/<pk>/ - should return an entity with given id
  • PUT api/cinema/<entity>/<pk>/ - should update the entity with given id based on passed data
  • PATCH api/cinema/<entity>/<pk>/ - should partially update the entity with given id based on passed data
  • DELETE api/cinema/<entity>/<pk>/ - should delete the entity with given id

py-api-views's People

Contributors

masterpieceelbow avatar abnormaltype avatar tpolina avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.