Re: Is this not allowed select_related()

2007-08-10 Thread james_027
THanks Doug > > class Employee(models.Model): > # your employee model fields here, no FKs to Contact or > Assignment models > ... > > class EmployeeAssignment(models.Model): > active = models.BooleanField() # I added this > employee = models.ForeignKey(Employee) > ... > >

Re: Is this not allowed select_related()

2007-08-09 Thread Doug B
maybe something like this... class Employee(models.Model): # your employee model fields here, no FKs to Contact or Assignment models ... class EmployeeAssignment(models.Model): active = models.BooleanField() # I added this employee = models.ForeignKey(Employee) ... class

Re: Is this not allowed select_related()

2007-08-09 Thread james_027
hi collin, On Aug 10, 11:26 am, Collin Grady <[EMAIL PROTECTED]> wrote: > What do you mean by "get the history" ? the employee could have new contract & assignment as months goes by. the employee_contract & employee_assignment tells of their recent contract & assignment. while the employee

Re: Is this not allowed select_related()

2007-08-09 Thread Collin Grady
What do you mean by "get the history" ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send

Re: Is this not allowed select_related()

2007-08-09 Thread james_027
hi, On Aug 9, 11:37 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > He means that you can remove: > > employee = models.ForeignKey(Employee) > > from your 'EmployeeAssignment' and 'EmployeeContract' models because > the relationship is already defined in your 'Employee' model. You can >

Re: Is this not allowed select_related()

2007-08-09 Thread [EMAIL PROTECTED]
He means that you can remove: employee = models.ForeignKey(Employee) from your 'EmployeeAssignment' and 'EmployeeContract' models because the relationship is already defined in your 'Employee' model. You can use reverse relations to get the relation instead. On Aug 8, 10:58 pm, james_027

Re: Is this not allowed select_related()

2007-08-08 Thread james_027
Hi collin On Aug 9, 1:06 pm, Collin Grady <[EMAIL PROTECTED]> wrote: > Because you have an infinite loop there. > > Why are you linking both directions? There's a reverse relation > available to get from EmployeeAssignment and EmployeeContract back to > the Employee model, you don't need to

Re: Is this not allowed select_related()

2007-08-08 Thread Collin Grady
Because you have an infinite loop there. Why are you linking both directions? There's a reverse relation available to get from EmployeeAssignment and EmployeeContract back to the Employee model, you don't need to explicitly define it. --~--~-~--~~~---~--~~ You

Is this not allowed select_related()

2007-08-08 Thread james_027
hi, I have this model which doesn't work when using select_related(). What happen is django seems to be in a infinite loop. class Employee(models.Model): employee_contract = models.ForeignKey('EmployeeContract', related_name='contracted_employee') employee_assignment =