Hi,

below is model

class Employee(models.Model):
  name = models.CharField(max_length=50, primary_key=True)
  dep = models.CharField(max_length=10)
  class Meta(object):
    db_table = u'employee'

class EmpSal(models.Model):
  emp_name = models.ForeignKey(Employee, db_column='emp_name')
  emp_sal = models.FloatField()
  class Meta(object):
    db_table = u'empsal'

class EmpWork(models.Model):
  emp_wrk = models.ForeignKey(Employee, db_column='emp_wrk')
  emp_doj = models.DateField()
  class Meta(object):
    db_table = u'empwork'

here i can make join from EMployee and EmpWork

 EmpWork.object.filter(emp_wrk__dep)

here i can make join from EMployee and EmpSal

   EmpSal.object.filter(emp_name__dep)

My Questions:

   - 
   
   how to make a relation between EmpWork and EMPSal 
   - 
   
   how to join all three once Employee,EMPWork,EMPSal
   - if i want to make a relation 

Employee.objects.filter(empsal__emp_sal=10000).values('name') ?

this return empty list ?

   - how to get all the employee sal who's doj is example '2010-10-15' ? 

If possible can you please give example with making relation with ORM

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/R0xscklQV0NOUXdK.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to