I have a model
named Company_Position_Person
that determine each person works in a company with specified position between startDate
and endDate
:
class Company_Position_Person(models.Model):
company_position=models.ForeignKey(Company_Position)
person=models.ForeignKey(Person)
startDate=models.CharField(max_length=25)
endDate=models.CharField(max_length=25)
Now I want to find the List of colleagues of a specific person based on date overlapping.I mean find out which persons works at this company at the same time that a specific person works.For example I work in company at startDate=2012-01-01
- endDate=2012-21-12
.Another person that works at the same company at startDate=2012-08-01
- endDate=2013-21-12
is a colleague of me at this time.
I found out that custome managers can be useful but I don't know how to find out overlapping while running query and how to pass startDate
and endDate
of specific person to the manager.