Build a Rest API with Django Rest Framework

Sdílet
Vložit
  • čas přidán 2. 06. 2024
  • This is a Django crash course that will help you build a REST API
    Github Repo:
    github.com/harblaith7/Django-...
    Timeline:
    0:00 - Intro to Django
    4:00 - Models
    8:30 - Views
    12:30 - Urls
    18:00 - Migrations
    20:45 - Serializers
    51:18 - Class View
    1:03:30 - Model Serializer

Komentáře • 53

  • @tomgauthier843
    @tomgauthier843 Před rokem +11

    I LOVE how you spent most of the tutorial showing the explicit but repetitive way of doing it. What makes me stuck with Django REST Framework is that there is too much "magic" going on. It's so important to see how it works in details when we're not using ModelSerializers or other magic classes.

  • @chauhanvats3
    @chauhanvats3 Před 2 lety +4

    This was a really good, concise and accurate course. Thanks!

  • @magicmedia7950
    @magicmedia7950 Před 2 lety +1

    Best explanation on Django API I have come across on CZcams. Thanks for sharing

  • @calistusobeke7520
    @calistusobeke7520 Před 2 lety +17

    Am a frontend developer, but just started backend (django) late last month. I must confess this is the third video tutorial have gone through on CZcams on Django, but this very one is top notch. Thanks for sharing.
    I will be glad if you can also share authentications (register and login) as well. Thanks a bunch

  • @entity5678
    @entity5678 Před 11 měsíci +1

    This is my first video on this channel..subscribed to your channel. What an underrated channel!! You deserve millions of subscribers. I am going to watch your videos..

  • @ekeneezedi1065
    @ekeneezedi1065 Před rokem +1

    was struggling to undertand django after buying a course, if only i had seen this video, loved the detailed explanation, great job

  • @CharlesBLim
    @CharlesBLim Před 2 lety

    This is a great tutorial.. I was looking for a quick tutorial and this one is just right.

  • @moylababa8196
    @moylababa8196 Před 2 lety +2

    you explain every things very well. after tried lots of premium and youtube docker tutorial, finally your docker crash course make things easy for me. Please make a nodejs microservices tutorial with kafka if possible.best wishes

  • @amadeuscam1
    @amadeuscam1 Před 2 lety +2

    Great tutorial as always!!!

  • @muhammadayaz8080
    @muhammadayaz8080 Před rokem

    love the way you teach. So calm and easy. Even if my native language isn't english, I can fully understand you. Love from Pakistan.

  • @imranomarbukhsh
    @imranomarbukhsh Před rokem

    Thanks a lot for the amazing course!

  • @sorooshmoghimi5494
    @sorooshmoghimi5494 Před rokem

    you make it really simple! thank you so much

  • @allamyratannayev9048
    @allamyratannayev9048 Před 9 měsíci

    good job i search django tutorial in youtube and your tutorial very clearly for me thanks
    👌

  • @mbkr230
    @mbkr230 Před 2 lety +3

    Any chance you’d be able to please make a react pagination video, where the data is coming from an api but also include a search bar in the same project?

  • @brucesun306
    @brucesun306 Před 2 lety

    Excellent tutorial, very thanks

  • @kevincodes674
    @kevincodes674 Před 2 lety

    thanks for the tutorial. it was very helpful.

  • @lucasfteodoro
    @lucasfteodoro Před rokem

    Thank you for this video! It was awesome =]

  • @jonl316
    @jonl316 Před rokem

    Awesome video, thanks so much.

  • @coolsai
    @coolsai Před 2 lety

    Very helpful thanks a lot !

  • @DanielValenzuelaPerez

    Great tutorial!

  • @natannegara
    @natannegara Před rokem

    I like this, very clear

  • @z.heisenberg
    @z.heisenberg Před 4 měsíci

    subscribed sir..wont say much..but u cleared everything thank you.

  • @mohdqayyoomkhan2446
    @mohdqayyoomkhan2446 Před rokem

    Great tutorial

  • @lhurdimpraim8411
    @lhurdimpraim8411 Před rokem

    Very helpful for a beginner. Please do authentications and authorizations too. Needed urgently

  • @silkyslim2111
    @silkyslim2111 Před rokem

    OMG! Thanks so much!

  • @shetty8222
    @shetty8222 Před 2 lety

    Hi, what if i want to update only one field? For example I want to update description of id "1"???

  • @sumitbhatkar5041
    @sumitbhatkar5041 Před 2 lety +1

    I will be glad if you can also share authentications (register and login) as well. Thanks a bunch

  • @zulfiqar7967
    @zulfiqar7967 Před 2 lety +3

    On next video, try to do Web3, Blockchain course

  • @adetonwaayodeji9815
    @adetonwaayodeji9815 Před rokem

    Nice tutorial.
    Please what about authentications

  • @tkomiljonov
    @tkomiljonov Před 9 měsíci

    thank u very much

  • @whatvideo3107
    @whatvideo3107 Před rokem

    thank you, everything you have done happens in the api. what about the real app?. consider someone who already has a django app, and they want to create an api to tinker with it. what changes can they make on this your code

  • @naufalnasrullah6965
    @naufalnasrullah6965 Před 7 měsíci

    need more django tutorial such as auth

  • @rangabharath4253
    @rangabharath4253 Před 2 lety

    awesome

  • @bassandre27
    @bassandre27 Před rokem

    When should I use viewsets instead of views?

  • @tomgauthier843
    @tomgauthier843 Před rokem +1

    Thanks

  • @kristosakalugwu2451
    @kristosakalugwu2451 Před 2 lety

    Hello, working with the get by pk function does not work when the id is not in the database, it returns an atribute error page

    • @nikhil.r.sirimane1749
      @nikhil.r.sirimane1749 Před rokem

      The get_book_by_pk function returns the error response to the get function, instead make the get function return the error response.
      class putpostdelete(APIView):
      def get_book(self,pk):
      try:
      book = Book.objects.get(pk=pk)
      return book
      except:
      return 1
      # return Response({
      # "Error":"Book does not exist"
      # },status=status.HTTP_404_NOT_FOUND)

      def get(self,request,pk):
      book=self.get_book(pk)
      if book==1:
      return Response({
      "Error":"Book does not exist"
      },status=status.HTTP_404_NOT_FOUND)
      Smoething like this.

  • @allamyratannayev9048
    @allamyratannayev9048 Před 9 měsíci

    can you write e-commerce use django all fremwork(rest_api,auth,static_file ,templates,users,)

  • @mahendranath2504
    @mahendranath2504 Před 6 měsíci

    Thank you so much for the amazing content 👍🙏🤝👋🫡👌🫶🏻✌️👏🏻😎👌🫶🏻

  • @francistrujillo2488
    @francistrujillo2488 Před 3 měsíci

    Your repo does not have the code pushed. main branch only without any of your code.

  • @Saketh-Chandra
    @Saketh-Chandra Před 2 lety +1

    Can we have the Source code for reference?

  • @koffeegod
    @koffeegod Před rokem

    From where is the create() method (at this timestamp: czcams.com/video/mlr9BF4JomE/video.html) in the Book model called? I didn't see it anywhere in the code.

  • @murshid956
    @murshid956 Před 3 měsíci

    the code is not available in the repo. can you update it.

  • @aadhilaadhil5173
    @aadhilaadhil5173 Před rokem

    this api working for integrating in flutter

  • @aer1al0
    @aer1al0 Před 2 lety

    lol you r the goat

  • @KrishnaVlogs352
    @KrishnaVlogs352 Před rokem

    Integration of Chrome extension and api calls plase

  • @ridl27
    @ridl27 Před 2 lety

    code ? коде ?

  • @bhatesaim
    @bhatesaim Před 3 měsíci

    This video is so hard to follow. Immediately after typing new code, you switch to a different file, so the viewer has to rewind the video if they didn't type everything that you just typed, down to the second. When you refactor, why are you doing that? What are the benefits and disadvantages? After we refactor using APIView, your justification is "I like that a whole lot better." These aren't legos or a painting of a lake, it's logical code and knowing the WHY matters a ton, especially if we're refactoring something for the third time.

  • @waceemvirk7396
    @waceemvirk7396 Před rokem +3

    If you pass a wrong id while fetching against id it will trough an error. It will not work with get_by_pk function if but If your try this method it will work perfectly because it's returning from the above function and after it will be inside get function to try this method. Thanks
    def get(self, request, pk):
    try:
    book = Book.objects.get(pk=pk)
    serializer = BookSerializer(book)
    return Response(serializer.data)
    except:
    return Response({
    'error': 'Book does not exist'
    }, status=status.HTTP_400_BAD_REQUEST)

    • @kuipercat8899
      @kuipercat8899 Před 6 měsíci

      Thank you! Was wondering what was wrong with my code, but this helped.

  • @yaolu485
    @yaolu485 Před 6 měsíci

    For those who are confuzed about why the PUT mehtod acting like a POST in the section of "Class View"
    One return is missed in the demostration, it should be like this(I have my own variation repalced book with picture):
    def get_picture_by_pk(self,pk):
    try:
    picture = Picture.objects.get(pk=pk)
    return picture

    except:
    return Response({"Error":"picture not found"},status=status.HTTP_404_NOT_FOUND)

  • @coolsai
    @coolsai Před 2 lety

    Very helpful thanks a lot !