목록Personal DB (108)
Silver Library (Archived)
stackoverflow.com/questions/2165865/django-queries-id-vs-pk Django queries - id vs pk When writing django queries one can use both id/pk as query parameters. Object.objects.get(id=1) Object.objects.get(pk=1) I know that pk stands for Primary Key and is just a shortcut, according to stackoverflow.com docs.djangoproject.com/en/3.1/topics/db/models/#meta-options Models | Django documentation | Djan..
Django will never understand the following code error: type: spacing error {% something %} OK { % something % } No
*Imagine how html works. Or maybe how other languages work! class based view *context links to the template. (class)Listview may specialised in inheritance. (e.g. each action shall work accordingly) function based view may specialised in filtering stuff (e.g. aggregately run as intended)
,Jango has a method to convert class based view turn them as.view Before urlpatterns = [path("", room_views.all_rooms, name="home")] Mid urlpatterns = [path("", room_views.HomeView, name="home")] # This will not work since HomeView is not recognised as Class. After urlpatterns = [path("", room_views.HomeView.as_view(), name="home")] # By adding as_view() here, now it recognises HomeView as Class..