“QuerySet o Que” Kod odpowiedzi

QuerySet o Que

>>> Post.objects.order_by('-created_date')
<QuerySet [<Post: 4th title of post>,  <Post: My 3rd post!>, <Post: Post number 2>, <Post: Sample title>]>
Repulsive Raccoon

QuerySet o Que

>>> me = User.objects.get(username='ola')
Repulsive Raccoon

QuerySet o Que

>>> Post.objects.filter(title__contains='title')
<QuerySet [<Post: Sample title>, <Post: 4th title of post>]>
Repulsive Raccoon

QuerySet o Que

>>> post.publish()
Repulsive Raccoon

QuerySet o Que

>>> Post.objects.filter(published_date__lte=timezone.now()).order_by('published_date')
<QuerySet [<Post: Post number 2>, <Post: My 3rd post!>, <Post: 4th title of post>, <Post: Sample title>]>
Repulsive Raccoon

QuerySet o Que

>>> Post.objects.create(author=me, title='Sample title', text='Test')
Repulsive Raccoon

QuerySet o Que

>>> Post.objects.filter(author=me)
<QuerySet [<Post: Sample title>, <Post: Post number 2>, <Post: My 3rd post!>, <Post: 4th title of post>]>
Repulsive Raccoon

QuerySet o Que

>>> Post.objects.filter(published_date__lte=timezone.now())
<QuerySet [<Post: Sample title>]>
Repulsive Raccoon

QuerySet o Que

>>> Post.objects.order_by('created_date')
<QuerySet [<Post: Sample title>, <Post: Post number 2>, <Post: My 3rd post!>, <Post: 4th title of post>]>
Repulsive Raccoon

Odpowiedzi podobne do “QuerySet o Que”

Pytania podobne do “QuerySet o Que”

Więcej pokrewnych odpowiedzi na “QuerySet o Que” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu