1👍
✅
What I can Understand from you Data models, is that You want to Get those Employee Objects which are not present as Foreign key in RemEmployee Table.
So, you can find this by following query
Employee.objects.filter(rememployee__isnull=True).values_list('employeeno', flat=True)
Note: Although you have made Foreign key as unique in RemEmployee which makes it a OneToOne key(Not related to question but just telling)
1👍
Employee.objects.exclude(employeeno__in=RemEmployee.objects.values_list('employeeno', flat=True))
This will return all Employee
objects whose employeeno
isn’t shared by any RemEmployee
objects.
- [Answered ]-Django Channels: How to flush send buffer
- [Answered ]-Url for 404 page in Django
- [Answered ]-Scope of dictionary passed in render_to_response
- [Answered ]-Django admin redirecting to custom view
Source:stackexchange.com