Monday, August 28, 2017

Re: django filter

I did that but the approved leave is still showing on the table.

Cheers

On Tue, Aug 29, 2017 at 2:44 PM, sum abiut <suabiut@gmail.com> wrote:
Thanks heaps Muhammad.
Sum

On Tue, Aug 29, 2017 at 10:13 AM, Muhammad M <mwebbie13@gmail.com> wrote:
Hi Sum,

Add an "approved" field of type BooleanField ( ) to your Leave model. 

So, something like this should work: 

In app/models.py:

class Leave (models.Model):
    #other fields go here...
    approved = models.BooleanField ( )

In app/views.py, handle the query like this:
     unapproved_leaves = Leave.objects.filter (approved=False)

Then, do with the returned queryset as you wish. 

Best of luck.

Sincerely,
Muhammad 

On Aug 28, 2017 7:06 PM, "sum abiut" <suabiut@gmail.com> wrote:
Hi all,
i am working on an eleave system where staff apply for annual leave and their leave manager approved the leave online.

currently i have a table that shows all the leave for each department. what i want to accomplished is to only show the leave that are not yet approved on the table. Any leave that have been approved should not be showing on the table.

Please point me to the right direction.


Cheers

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y6f6%3DWtOW%3DQNW%3DD59gWtAmc3avZ4s3jHA09Pgj6C4yXEQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJOFuZzTnxOAnmNUBPJP3A3w5ud%2BUYa9W1ZTaTbiTNHnoF1f7A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



-- 



-- 

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y5v1vM%3Dkz1gwxyjHUpqRX496W2vVDwcveOc%3DzE4sCPixg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment