hi Sam, Here is example model:
class Profile(models.Model): name = models.CharField(max_length=50, primary_key=True) assign = models.CharField(max_length=50) doj = models.DateField() dob = models.DateField() class Meta: db_table = u'profile' def __str__(self): return '%s %s %s %s' % ( self.name,self.assign,self.doj,self.dob) def __unicode__(self): return u'%s %s %s %s' % ( self.name,self.assign,self.doj,self.dob) class working(models.Model): w_name =models.ForeignKey(Profile, db_column='w_name') monday = models.IntegerField(null=True, db_column='monday', blank=True) tuesday = models.IntegerField(null=True, db_column='tuesday', blank=True) wednesday = models.IntegerField(null=True, db_column='wednesday', blank=True) class Meta: db_table = u'working' def __str__(self): return '%s %s %s %s' % ( self.w_name,self.monday,self.tuesday,self.wednesday) def __unicode__(self): return u'%s %s %s %s' % ( self.w_name,self.monday,self.tuesday,self.wednesday) >>> m=working.objects.filter(w_name__name='sushanth') >>> m.query.as_sql() (u'SELECT `working`.`id`, `working`.`w_name`, `working`.`monday`, `working`.`tuesday`, `working`.`wednesday` FROM `working` WHERE `working`.`w_name` = %s ', ('sushanth',)) >>> But i am not getting any joins in above ........... any suggestions ......... -- 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 email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.