Boolean field on notification model that change status when click or view the notification , this perhaps need an asynchronous task with jQuery or celery
Rewards El vie., 29 de mayo de 2020 9:28 p. m., meera gangani < meeragangan...@gmail.com> escribió: > 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 <meeragangan...@gmail.com> > 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 <sencerhama...@gmail.com> >> 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 <meeragangan...@gmail.com> >>> 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 django-users+unsubscr...@googlegroups.com. >>>> 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 django-users+unsubscr...@googlegroups.com. >>> 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 django-users+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CANaPPPLnRv2matia%2B6Xm9j0cSoNHYWnn8HMt08ojmqxQOrXvCg%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CANaPPPLnRv2matia%2B6Xm9j0cSoNHYWnn8HMt08ojmqxQOrXvCg%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 django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHRQUH%3DZniCZo8YLG%3DG%3DbXQDJddqQ1%2BGGLFnFx4A_jrtLerjeg%40mail.gmail.com.