Bro, this série is definitely great. Could you add some example on how to connect this backend to a front end. It does not have to be something fancy, just to see how data are fetched from the front end especially when authentication or some permission is needed.
Thanks! I'm planning an app-based API integration series soon. Could add a small example of frontend integration near the end of this series, as I know it's the main use-case.
Yes it does - this works automatically because the database cascades the delete to the child OrderItems. See this field here and the "on_delete=models.CASCADE" argument: github.com/bugbytes-io/drf-course-api/blob/master/Video25/api/models.py#L47-L51
What is the best approach? I usually get all existing items by request like items= Item.objects.value_list("id", flat=True) and compare with input id data. After that via set i update only items that have changed. But you delete all the data How is it for db?
Comme il l'avait dit, il a simplifié les choses. Naturellement, si vous ne voulez pas supprimer les anciennes données, vous pouvez le faire comme vous l'avez décrit. Le problème avec votre méthode, c'est qu'elle prend beaucoup plus de temps. À vous de trouver la meilleure solution pour votre projet. Et si jamais le modèle n'autorise pas de suppression, la méthode présentée ici produira une erreur 500 en production.
With transactions_atomic everything makes sense for the db. Or either there will be no change if there is some error in the process or it will delete and save the new data in the same action...it is programatically faster to do it this way unless items would be a very large list...
Very clear! Thanks a lot 👍
@@ndifrekeumoren3548 thank you!
Great video! (I think you need a None default on your pop in the update case since items key is not required)
Thanks ...🎉
Thanks a lot!
thank you!
@@aashayamballi thanks for watching!
good thank you
@@frameff9073 thanks for watching!
And it's interesting to use get_fields method instead get_serialiser_class
Bro, this série is definitely great.
Could you add some example on how to connect this backend to a front end.
It does not have to be something fancy, just to see how data are fetched from the front end especially when authentication or some permission is needed.
Thanks! I'm planning an app-based API integration series soon. Could add a small example of frontend integration near the end of this series, as I know it's the main use-case.
Thanks for the video. Great explanation. Could you use Valkey(free redis' fork) instead of Redis?
I've not planned to use that for the next videos, but will look into it for future ones - what is the benefit over the normal Redis?
Does the delete in Order also delete the related OrderItems?
Yes it does - this works automatically because the database cascades the delete to the child OrderItems. See this field here and the "on_delete=models.CASCADE" argument:
github.com/bugbytes-io/drf-course-api/blob/master/Video25/api/models.py#L47-L51
@bugbytes3923 Forgot about that part. Thank you
Brother can you please combine all the videos in one video please I request you 😅
What is the best approach?
I usually get all existing items by request like items= Item.objects.value_list("id", flat=True) and compare with input id data. After that via set i update only items that have changed.
But you delete all the data
How is it for db?
Comme il l'avait dit, il a simplifié les choses. Naturellement, si vous ne voulez pas supprimer les anciennes données, vous pouvez le faire comme vous l'avez décrit. Le problème avec votre méthode, c'est qu'elle prend beaucoup plus de temps. À vous de trouver la meilleure solution pour votre projet.
Et si jamais le modèle n'autorise pas de suppression, la méthode présentée ici produira une erreur 500 en production.
With transactions_atomic everything makes sense for the db. Or either there will be no change if there is some error in the process or it will delete and save the new data in the same action...it is programatically faster to do it this way unless items would be a very large list...
@@XavierLarrea I meant useless queries to db like deleting and after that adding the same nested entities
@@Developer_python_ In some cases this can be controlled on the frontend side by sending partial updates with patch
How long do you think this course is gonna last?
I want to finish it as soon as possible.