Django 2 Models Tutorial For Beginners (2018)

  Рет қаралды 5,538

The Dumbfounds

The Dumbfounds

Күн бұрын

Пікірлер: 13
@thedumbfounds767
@thedumbfounds767 6 жыл бұрын
Note: the .create() method calls .save() automatically so there is no need to call it explicitly afterwards.
@Skaxarrat
@Skaxarrat 6 жыл бұрын
When we should use ModelName.objects.get(id=id) and when get_object_or_404(ModelName, id=id)? What are the differences?
@thedumbfounds767
@thedumbfounds767 6 жыл бұрын
ModelName.objects.get(id=id) alone is problematic because it will give you an error if the model with that id doesn't exist, which is why it should be wrapped in a try-except block. get_object_or_404 is a helper function that automatically takes care of returning a 404 error if the model with that id doesn't exist. However, you should use get_object_or_404 only in views. Btw: the get_object_or_404 function uses ModelName.objects.get(id=id) under the hood with a try-except block. Here is the code for more information: github.com/django/django/blob/master/django/shortcuts.py. Any more questions?
@topiaamr
@topiaamr 6 жыл бұрын
AWESOME !! Thank you for the tut
@thedumbfounds767
@thedumbfounds767 6 жыл бұрын
you're welcome, Topia!
@gmoneep
@gmoneep 6 жыл бұрын
how to use django 2 with react - GrapgQL - apollo . i think all videos in this topic is old !! would you make a tut in that ??!
@thedumbfounds767
@thedumbfounds767 6 жыл бұрын
I'll perhaps show how to integrate frontend frameworks with APIs in the future. But essentially, because you expose endpoints (with GraphQL it's only 1), it can be consumed from any frontend, including react.
@Thesrik23
@Thesrik23 6 жыл бұрын
Nice work!
@thedumbfounds767
@thedumbfounds767 6 жыл бұрын
thanks dude, after one more video we'll get into more intermediate/advanced topics! :)
@Thesrik23
@Thesrik23 6 жыл бұрын
The Dumbfounds You are doing an amazing work mate. Keep it up!
@thedumbfounds767
@thedumbfounds767 6 жыл бұрын
thank you Srikant!
@azadabdullahshaheed
@azadabdullahshaheed 5 жыл бұрын
For beginner tutorial using views is better than python shell.
@thedumbfounds767
@thedumbfounds767 5 жыл бұрын
Thanks for the feedback. Thought it might be good not to mix the two when explaining how to deal with models.
Django 2 Class-Based Views Tutorial (+ Generic Views)
5:56
The Dumbfounds
Рет қаралды 9 М.
Django Authentication Basics
19:38
Pretty Printed
Рет қаралды 109 М.
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 46 МЛН
ДЕНЬ УЧИТЕЛЯ В ШКОЛЕ
01:00
SIDELNIKOVVV
Рет қаралды 4 МЛН
버블티로 부자 구별하는법4
00:11
진영민yeongmin
Рет қаралды 18 МЛН
Хасанның өзі эфирге шықты! “Қылмыстық топқа қатысым жоқ” дейді. Талғарда не болды? Халық сене ме?
09:25
Демократиялы Қазақстан / Демократический Казахстан
Рет қаралды 300 М.
Django Forms Tutorial For Beginners - Get Started Fast! (2018)
29:36
The Dumbfounds
Рет қаралды 165 М.
Django REST Framework Model Relationships
14:32
Pretty Printed
Рет қаралды 67 М.
Django Design Patterns - URLs Best Practises (Part 1)
12:04
The Dumbfounds
Рет қаралды 26 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 809 М.
Django Templates Tutorial For Beginners (2018)
10:49
The Dumbfounds
Рет қаралды 11 М.
Learn Django in 20 Minutes!!
21:25
Tech With Tim
Рет қаралды 387 М.
PostgreSQL CRASH COURSE - Learn PostgreSQL in 2024
50:26
Django Design Patterns - Models (Part 3)
9:37
The Dumbfounds
Рет қаралды 6 М.
How to Use Django REST Framework Permissions
11:06
Pretty Printed
Рет қаралды 40 М.
Don't look down on anyone#devil  #lilith  #funny  #shorts
00:12
Devil Lilith
Рет қаралды 46 МЛН