Hi all,

How to create orm query with data exist or not ?

How to check if approval_status Pending and Rejected with same user
contains

from_date       approval_status           User
2023-01-20  -     Approved                    NewUser
2023-01-12  -     Rejected                   NewUser
2023-01-06  -    Approved                   NewUser



If User contains above details in month between Create "
        Timesheet Model"     Eg:
Timesheet.objects.create(date=date,emaployee=emp,status=1)

leave_data =
EmployeeLeaves.objects.filter(~Q(approval_status='Approved'),~Q(approval_status='Cancelled'),~Q(approval_status='Rejected'),

 from_date__gte=month_first_date, to_date__lte=month_last_day,
                                                   employee=request.user).


If User Contains Pending Don't create Model

leaves_data = EmployeeLeaves.objects.filter(~Q(approval_status='Pending'),

from_date__gte=month_first_date, to_date__lte=month_last_day,
                                                    employee=request.user).

-- 
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/CAMCU6CoJkrj6b0Th5NnGMnq4hpcNbtFE1X6ZqREJfBK2KA-wRg%40mail.gmail.com.

Reply via email to