Single Handedly the BEST video series on Django Rest Framework I've ever seen, and seen them all on RUclips, Udemy, etc. Concise, technical but just enough vanilla. Can't fully express my gratitude. This tutorial is so good that even though I have a student budget (haha) Iḿ really considering buying your courses. PERFECT!
Awesome explanation. To those who get 'rest_framework.serializers' has no attribute 'HyperLinkedModelSerializer' error, this is due to the ModelSerializer itself handles the hyperlink url in the latest versions of rest_framework. Therefore, in the serializer class, you may inherit from ModelSerializer itself like class ParadigmSerializer(serializers.ModelSerializer):
Hi, I love your Django Series. I'm not able to understand how to use authentication and authorization with Rest framework. Can you please help me with that!
Why the dropdown of the foreign keys of the 10:07 minute does not appear to me? I am using the following versions: Django = 3.0.4 djangorestframework = 3.11.0 djangorestframework-jwt = 1.11.0 psycopg2-binary = 2.8.3 (for Postgresql) gunicorn = 20.0.4 pyjwt = 1.7
2 года назад
hi, I had same problem while, you have to add field to your LanguageSerializer class fields = ('id', 'url', 'name', 'paradigm')
Hi, I liked your video. I have a question for you. Based on the above example that you have shown, instead of many to many relationships, one to many relations works more good right? Because its also like one programmer can have multiple languages
I kinda followed u step by step but i get an error cause of the hyperlinkedmodel........." Could not resolve URL for hyperlinked relationship using view name", why do i have this error when i have followed the same steps as he did meh
I get Assertion error, after adding ForeignKey, "should either include a `serializer_class` attribute, or override the `get_serializer_class()` method." what should i do?
6 лет назад+1
Please make a course on your website about Django Rest Framework, including as much as you can... I'd buy it definitely.
How would you manage voters-polls, as many to many, but in a such way, that voter can do a certain poll only once? When a new poll is created, would you first immediately add all existing polls to him, and how would you set voted flag on a pivot table, so that he wouldn't be able to vote again on that particular poll. Thanks.
I'm having an issue: instead of using sqlite3 I am using postgres, however whenever I try to use the MyModel.objects.all() it simply states that my model does not have a property or method named objects.
Hi, I would just like to ask why my languages field in ruclips.net/video/QB9gGEwxxM4/видео.html is not showing and just the Name field? Awesome video by the way!!
Great video! Could you please show me how to create resources using postman or any other type of client? The browsable api sometimes seems too "magic" for me.
Thank you! Your tutorials are great. Is there a way to change the hyperlink for the user to still take you to the user, but SHOW the username? Or show the language names known by each user? make it more human readable? i.e Bob/
Thanks for the very helpful videos! I'm working on a page it has a form and inside it has many comboboxes containing data from each tables, I created for each table in my database a serializer class and a view to retrieve data from each tables, the problem is while I load this form page it takes a while to load. So i'm guessing if there's a way to join unrelated models
Hey, Anthony, good video here! :) thanks. Can you make me understand when I must to set _on_delete_ param to CASCADE or PROTECT or something else? What are they doing? What’s choosing? More usage example are welcome (and good idea for next episode, btw)
I'll make a video for that. But basically the idea to prevent invalid data. If you delete a part row, you must consider what happens to its children, and on_delete helps you with that. CASCADE simply deletes all the children. PROTECT stops you from deleting a parent when children exists.
You should be able to, but I haven't tried it yet. You may have to override the to_representation method. www.django-rest-framework.org/api-guide/serializers/#to_representationself-obj
shouldn't be the languages not urls , but instead the object properties of the languages. so in a front-end app. we're going to fetch those urls 3x instead of 1? I think its better to have something like this { "languages":[ {"id":1, "name":"Java", "paradigm":{"id":1,"name":"OOP"} } ] }
@@prettyprinted Thanks once again. While this is very helpful for me and is what i might actually redirect to, however, i was looking as something like this that has many relationships e.g custommodel = models.ManyToManyField('self', through='JoiningTable', symetrical=False). Django doesnt populate the joining table or how do i get to do that with the api.
thanks for the great series of tutorial . but one question what will happen if we want to add a many to many between 2 models and some how make a third model for making the relation between them ??
I don't understand what you mean. Are you trying to use the third model as the model that will hold the data from both tables, or do you want a third table to related to one of the first two in some way?
@@prettyprinted actually yes third table to join the other 2 tables in laravel we call it pivot table and its responsible for many yo many relationships :)
@@farshadbadiee7133 What Laravel calls a pivot table Django does automatically. Since pivot tables are very simple, there's need to specify them directly in Django.
This was a good video, but it lacked practical use, such as making actual api calls on an application, even if a simple one, to demonstrate these concepts better.
dude it totally stupid part of video better u should remove two model table api cant work their (imagine if u create 3 and have instances different id ) probably when u click on api pk value it open on different id just assume id save differently foreignkey doesnt help u to give different id for exact model table
Join my free course on building a Todo API with Django REST Framework: prettyprinted.com/djangotodoapi
Two years late, but this is one of the most useful resources I have come across.
Single Handedly the BEST video series on Django Rest Framework I've ever seen, and seen them all on RUclips, Udemy, etc. Concise, technical but just enough vanilla. Can't fully express my gratitude. This tutorial is so good that even though I have a student budget (haha) Iḿ really considering buying your courses. PERFECT!
True, this is the core and wasted some 40 hours in udemy.
Can you drop the playlist link
Awesome explanation. To those who get 'rest_framework.serializers' has no attribute 'HyperLinkedModelSerializer' error, this is due to the ModelSerializer itself handles the hyperlink url in the latest versions of rest_framework.
Therefore, in the serializer class, you may inherit from ModelSerializer itself like class ParadigmSerializer(serializers.ModelSerializer):
Thanks!
ModelSerializer seems to bring the urls for its own model and will not work for fields such as ForeignKey which are mentioned in a different model.
Thank you for this please keep on posting great videos like these.
Watched so many drf related videos, no one was as clear as you.
You might not know it! But you saved me a lot of research on my bachelor project, thanks a lot
Thanks a lot man...
Lots of love from India
Thanks for this useful explanation.
Hi, I love your Django Series. I'm not able to understand how to use authentication and authorization with Rest framework. Can you please help me with that!
Why the dropdown of the foreign keys of the 10:07 minute does not appear to me?
I am using the following versions:
Django = 3.0.4
djangorestframework = 3.11.0
djangorestframework-jwt = 1.11.0
psycopg2-binary = 2.8.3 (for Postgresql)
gunicorn = 20.0.4
pyjwt = 1.7
hi, I had same problem while, you have to add field to your LanguageSerializer class fields = ('id', 'url', 'name', 'paradigm')
Hi..... you are just awesome, one of the best explanation in youtube on REST FRAMEWORK.... thanks a lot
You're welcome! Thanks for watching!
wowww, great work, amazing, huge thanks
Hi, I liked your video. I have a question for you. Based on the above example that you have shown, instead of many to many relationships, one to many relations works more good right? Because its also like one programmer can have multiple languages
I kinda followed u step by step but i get an error cause of the hyperlinkedmodel........." Could not resolve URL for hyperlinked relationship using view name", why do i have this error when i have followed the same steps as he did meh
Thanks man for great tutorial
Great man, keep continues excelent videos, thanks.
I won't stop! Thanks for watching.
I get Assertion error, after adding ForeignKey, "should either include a `serializer_class` attribute, or override the `get_serializer_class()` method." what should i do?
Please make a course on your website about Django Rest Framework, including as much as you can... I'd buy it definitely.
That's part of the plan. Hopefully I get to it within the next few months.
You're awesome man 🙌
Thanks brother! For django rest framework
You're welcome! Thanks for watching.
Thanks a lot for your tutorial!
If I may ask, would it be possible to views programmers tagged to each language like we have languages displayed for each programmer?
can i get the link of this project api. m not geting on your github or any below link.
It is so assuring to see someone else is having problem with typing serializers too. I feel you bro. 8:03
lol! I'm terrible at typing words I never use outside of programming.
Wow, this was so clear !
Thanks for watching!
How would you manage voters-polls, as many to many, but in a such way, that voter can do a certain poll only once? When a new poll is created, would you first immediately add all existing polls to him, and how would you set voted flag on a pivot table, so that he wouldn't be able to vote again on that particular poll. Thanks.
How do i change the colour of my api ..? Any idea !
Again very useful - thanks.
Thanks for watching!
is there a way to print the language name when viewing the programmer? Rather than the language id or url?
I'm having an issue: instead of using sqlite3 I am using postgres, however whenever I try to use the MyModel.objects.all() it simply states that my model does not have a property or method named objects.
What is the exact error text?
Hi, I would just like to ask why my languages field in ruclips.net/video/QB9gGEwxxM4/видео.html is not showing and just the Name field?
Awesome video by the way!!
But it works when I add the data via the admin
How t add status code and a message to the output json array
And if I want to show the name of the language and its paradigm in programmers?
Using your example, Could you get a list of languages based on the paridigm? Something like GET /languages?paradigm=1
if there will be 2 k languages, how to make pagination on it?
I'll probably make a video to cover this, but check this out: www.django-rest-framework.org/api-guide/pagination/
pagination inside json item?
{
'album_name': 'The Grey Album',
'artist': 'Danger Mouse'
'tracks': [
{'title': 'Public Service Announcement'},
{'title': 'What More Can I Say'},
{'title': 'Encore'},
............ 1k
],
}
Thanks a lot it's helped me >.<
Great video! Could you please show me how to create resources using postman or any other type of client? The browsable api sometimes seems too "magic" for me.
Loving your videos you have a new subscriber!
Thanks for watching and for subscribers.
Hi,you really teach very well!Could you teach something about filter?
Amazing!
Nice job! Thanks!
You're welcome! Thanks for watching.
Thank you! Your tutorials are great. Is there a way to change the hyperlink for the user to still take you to the user, but SHOW the username? Or show the language names known by each user? make it more human readable?
i.e Bob/
Good question. Can you please give the answer of your own question?
Thanks for your videos ^^
You're welcome!
Thanks for the very helpful videos!
I'm working on a page it has a form and inside it has many comboboxes containing data from each tables, I created for each table in my database a serializer class and a view to retrieve data from each tables, the problem is while I load this form page it takes a while to load. So i'm guessing if there's a way to join unrelated models
Maybe select_related or prefetch_related can help you.
от души братан
Hey, Anthony, good video here! :) thanks. Can you make me understand when I must to set _on_delete_ param to CASCADE or PROTECT or something else? What are they doing? What’s choosing? More usage example are welcome (and good idea for next episode, btw)
I'll make a video for that.
But basically the idea to prevent invalid data. If you delete a part row, you must consider what happens to its children, and on_delete helps you with that. CASCADE simply deletes all the children. PROTECT stops you from deleting a parent when children exists.
is there any way to add a non-model field in the serializer.
You should be able to, but I haven't tried it yet. You may have to override the to_representation method. www.django-rest-framework.org/api-guide/serializers/#to_representationself-obj
shouldn't be the languages not urls , but instead the object properties of the languages.
so in a front-end app. we're going to fetch those urls 3x instead of 1?
I think its better to have something like this
{
"languages":[
{"id":1,
"name":"Java",
"paradigm":{"id":1,"name":"OOP"}
}
]
}
got it.
just add `dept=1` in the class Meta of the serialize model
but I lost the capability to post languages if add the depth
hi love your videos. i have a question. how would you handle a self referencing model with a many to many relationship?
You use quotes. Like this: stackoverflow.com/questions/15285626/django-self-referential-foreign-key
@@prettyprinted Thanks once again. While this is very helpful for me and is what i might actually redirect to, however, i was looking as something like this that has many relationships e.g custommodel = models.ManyToManyField('self', through='JoiningTable', symetrical=False). Django doesnt populate the joining table or how do i get to do that with the api.
@@prettyprinted Also while trying that option, will i allow null=True ? especially for records that dont have a parent_id
@@maxennybee Yeah, if you don't expect each record to have parent, then you want null to be True.
thanks for the great series of tutorial . but one question what will happen if we want to add a many to many between 2 models and some how make a third model for making the relation between them ??
I don't understand what you mean. Are you trying to use the third model as the model that will hold the data from both tables, or do you want a third table to related to one of the first two in some way?
@@prettyprinted actually yes third table to join the other 2 tables in laravel we call it pivot table and its responsible for many yo many relationships :)
@@farshadbadiee7133 What Laravel calls a pivot table Django does automatically. Since pivot tables are very simple, there's need to specify them directly in Django.
@@prettyprinted Thanks For great answer do you have any plan to make any toturial about many to many realtionships ?
@@farshadbadiee7133 I will eventually.
Nice tuts! Can you please make videos on django AWS dynamodb?
I'll add that to my list. Thanks for the idea.
I can't read the code
Can you make a video about overriding create and update for nested serializers?
I'll consider that. Thanks for the idea.
Can you please help me with Authentication and Authorization with Django Rest Framework?
Videos on that are coming soon.
nice, would you like to share some complex example ?. thanks in advance
I definitely will make more complicated examples in the future.
This was a good video, but it lacked practical use, such as making actual api calls on an application, even if a simple one, to demonstrate these concepts better.
I'll consider making more realistic examples for this.
dude it totally stupid part of video better u should remove
two model table api cant work their (imagine if u create 3 and have instances different id ) probably when u click on api pk value it open on different id just assume id save differently foreignkey doesnt help u to give different id for exact model table