Re: Failed to understand syntax

2019-04-14 Thread Mayur Bagul
Thank a lot for your valuable information on asked topic. My double is clear now. Thanks to you and community. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to d

Re: Failed to understand syntax

2019-04-13 Thread Test Bot
That is because Question.objects.order_by("-pub_date") would give you a list of all records so you can simply apply slicing without the use of . operator. For understanding purpose, you can break down your code as result = Question.objects.order_by("-pub_date") > latest_question_list = result[:

Re: Failed to understand syntax

2019-04-13 Thread Mayur Bagul
Hello Judge95, thanks for useful information but i want to know how [:5] is used without . operator and how it is work. thanking you. On Friday, April 12, 2019 at 7:31:49 PM UTC+5:30, OnlineJudge95 wrote: > > The part you want to understand is same as ORDER BY clause in SQL. The > slicing will

Re: Failed to understand syntax

2019-04-12 Thread Test Bot
The part you want to understand is same as ORDER BY clause in SQL. The slicing will provide only the top 5 results. By default the order_by sorts in ascending order only. But providing a "-" would make it to sort in descending order. On Fri, Apr 12, 2019, 6:56 PM Mayur Bagul wrote: > Hello coder