Home > other >  Some people used in ChainedForeignKey xadmin again
Some people used in ChainedForeignKey xadmin again

Time:09-18

I installed the django - smart - selects the

Model. The py is

# set industry categories:
Class IndustryName (models. Model) :
Title=models. CharField (max_length=20, verbose_name="trade name") # define subtopic name
Created_date=models. DateTimeField (default=timezone. Now, the verbose_name='creation time, help_text=' article creation time ')

The class Meta:
Verbose_name='management industry categories'
Verbose_name_plural=verbose_name

Def the __str__ (self) :
Return the self. The title

Post # name
The class JobName (models. Model) :
Industry_title=models. ForeignKey (IndustryName, on_delete=models. The CASCADE, related_name='industry_title', help_text="industry")
Title=models. CharField (max_length=20, verbose_name='position, help_text="position name")
Created_date=models. DateTimeField (default=timezone. Now, the verbose_name='creation time, help_text=' creation time ')

The class Meta:
Verbose_name='name management'
Verbose_name_plural=verbose_name

Def the __str__ (self) :
Return the self. The title
# history information
The class JobSeekerInfo (models. Model) :
Name=models. CharField (max_length=20, verbose_name="name") # define subtopic name
Sex=models. CharField (max_length=6, choices=((" male ", u "male"), (" female ", u "female")), verbose_name="gender") # define subtopic name
Tel=models. CharField (max_length=11, verbose_name="contact") # define subtopic name
Email=models. EmailField (max_length=50, verbose_name="contact email", blank=True) # define subtopic name
Skill=models. ManyToManyField (SkillTag related_name='skilltags', blank=True, help_text="skills label")
Industry=models. ForeignKey (IndustryName, on_delete=models. The CASCADE, related_name='industry_name', help_text="industry")
# job=models. ForeignKey (JobName, on_delete=models. CASCADE, related_name='job_name', help_text="post")
Job=ChainedForeignKey (JobName, chained_field="industry", chained_model_field="industry", show_all=False, auto_choose=False, sort=True)
The content=UEditorField (' history information, the height=400, width=800, default=', imagePath="Aritcle_Images/% % Y/m", toolbars='besttome', filePath='Aritcle_File/% % Y/m, null=True, blank=True)


Adminx. Py is

The class JobSeekerInfoAdmin (object) :
List_display=[' name ', 'sex', 'tel', 'email', 'skill', 'industry', 'job']
Search_fields=[' name ', 'sex', 'tel', 'email', 'skill', 'industry', 'job']
List_filter=[' name ', 'sex', 'tel', 'email', 'skill', 'industry', 'job']
List_per_page=30

Ueditor style_fields={" content ":" "}

But in the page of xadmin unable to realize the industry and the job of the secondary linkage how to do with this?
  • Related