Thursday, January 8, 2015

Re: Pulling data from two table

Hi,
i am trying to pull out all the information in both model. i can pull out information in each table but i am a but confuse in joining the two tables together. something like NATURAL JOIN in mysql.

Cheers,


On Fri, Jan 9, 2015 at 12:07 PM, Vijay Khemlani <vkhemlan@gmail.com> wrote:
OK, what query are you trying to make? or what information do you want to display?

On Thu, Jan 8, 2015 at 6:50 PM, sum abiut <suabiut@gmail.com> wrote:
Hi Vijay,
Thank you for your email. Here is my models. i want to be able to pull out all the data from both table and display them. i am a bit new to django still finding my way out.


class staff(models.Model):
    First_Name = models.CharField(max_length=45)
    Last_Name =models.CharField(max_length=45)
    employee_Date=models.DateField()
    position=models.CharField(max_length =45)
    department=models.CharField(max_length =45)
    qualification=models.CharField(max_length =45)
    VNPF_no =models.CharField(max_length =45)
    salary =models.IntegerField()
    montly_salary=models.IntegerField()
    Training=models.TextField()
    username  =models.ForeignKey(User, default =1)
   
    def __unicode__(self):
        return self.First_Name
       
class leave(models.Model):
    leave_type =models.CharField(max_length=45)
    Specify_details=models.TextField(default="")
    start_Date =models.DateField()
    end_date=models.DateField()
    total_working_days=models.IntegerField()
    authorization =models.CharField(max_length=45)
    authorized_by=models.CharField(max_length=45,  default ="")
    remarks=models.TextField()
    authorizaion_date =models.DateField()
    username  =models.ForeignKey(User,  default =1)
    staff =models.ForeignKey(staff,  default =1)
    
    def __unicode__(self):
        return self.leave_type





On Fri, Jan 9, 2015 at 8:32 AM, Vijay Khemlani <vkhemlan@gmail.com> wrote:
Please be more specific in your question, how are these tables related? what models are they associated with?

On Thu, Jan 8, 2015 at 6:01 PM, sum abiut <suabiut@gmail.com> wrote:
Hi,
can someone please help. i am trying to pull data from two table in django and display the results. can someone please point me to the right direction.

kind regards,
Sum A


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y6DxaBuSiLYNr2dc3sAn70qB46_G5MTJzPoJPkG1-57PA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei0qKOsMrV-nVLrABSfBpbPAOCHgQDsaYXDS_EkNS4QEZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.



-

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y7%3D2xjk0xApyXpSnqvGHogYSdf7ztqnQUJtpvXSSamntQ%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CALn3ei3OudzfSz6408Mt8wd7n6xXyyXdVyBdSVRLqzNuw9rCag%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.



-

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPCf-y5bSoxnbjtradesJha5FO6AJBw65ka3eKZz%3DQ9Qz1oupQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment