0
我有Django模型說,Django的選擇查詢來獲取數據形成的所有子表
class JobApplication(models.Model):
job_application_id = models.AutoField(primary_key=True)
user_id = models.ForeignKey(User)
resume_id = models.ForeignKey(Resume)
class Resume(models.Model):
resume_id = models.AutoField(primary_key=True)
resume_name = models.CharField()
.... other fields
class Education(models.Model):
education_id = models.AutoField(primary_key=True)
resume_id = models.ForeignKey(Resume)
degree_name = models.CharField()
.... other fields
class Experience(models.Model):
experience_id = models.AutoField(primary_key=True)
resume_id = models.ForeignKey(Resume)
company_name = models.CharField()
.... other fields
class Skills(models.Model):
skill_id = models.AutoField(primary_key=True)
resume_id = models.ForeignKey(Resume)
skill_name = models.CharField()
.... other fields
我想查詢,設置針對在線招聘模型給定的作業ID,它應該獲取所有的相關教育,經驗,技能等參考簡歷ID對工作ID。 現在,我做這個單奎雷斯,就像我取從job_application resume_id然後取參考
resume_against_job =Jobapplication.objects.get_query_set().get_complete_Jobapplication(job_id)
for resum in resume_against_job:
resume_dict = {}
resume_id = resum['resume_id']
user_id = resum['user_id']
恢復的詳細信息,然後針對這些user_id
和resume_id
,我又寫了查詢,獲取用戶的細節和他們的簡歷細節。