I Want to implement Mark all a read in notification!!
So What should i do!!
Can you explain me a little bit of this!

On Sat, May 30, 2020 at 8:46 AM meera gangani <[email protected]>
wrote:

> Thank you So much for helping me out!!
> Thanks a lot
>
> Meera Gangani
>
> On Fri, May 29, 2020 at 5:08 PM Sencer Hamarat <[email protected]>
> wrote:
>
>> Hi Meera,
>>
>> You have only one record because of you are using .latest() method in the
>> query.
>>
>> If you want to last 3 or 4 object ordered by descending date, you should
>> write queryset like this:
>>
>> notifications = Notification.objects.all().order_by('-date')[0:x]  # The
>> 'x' could be 3 or 4 by your choice.
>>
>> An pass the notifications to request context in 'render_to_response'
>> call. {'notifications': notifications}
>>
>> The you have to iterate notifications in template via for loop. For
>> example;
>>
>> {% for notification in notifications %}
>> <div>notification.title</div>
>> <div>notification.message</div>
>> <div>notification.date</div>
>> {% endfor %}
>>
>> Saygılarımla,
>> Sencer HAMARAT
>>
>>
>>
>> On Fri, May 29, 2020 at 1:59 PM meera gangani <[email protected]>
>> wrote:
>>
>>> i want to fetch last 3 records for notification!!
>>> But I only fetch last 1 record.
>>>
>>> Can you please help me out!!!
>>> Can i use filters??
>>>
>>> And my model fields are:
>>> title=
>>> message=
>>> date=
>>>
>>> And i want to fetch last 3-4 records
>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CANaPPPJVprm5gE0FNFWqPDGdW_ciq15JQXLmjVHinJkHPwRdqQ%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CANaPPPJVprm5gE0FNFWqPDGdW_ciq15JQXLmjVHinJkHPwRdqQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CACp8TZh3iD4M2%3Ddq4NOrPTpOzAYCFxx_kduS6%2BK%2BEG2kPDFkYA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CACp8TZh3iD4M2%3Ddq4NOrPTpOzAYCFxx_kduS6%2BK%2BEG2kPDFkYA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CANaPPPLnRv2matia%2B6Xm9j0cSoNHYWnn8HMt08ojmqxQOrXvCg%40mail.gmail.com.

Reply via email to