python - Django: add a list filter option to filter related models under parent model -


i request assistance in matter

i have following models:

class job(models.model):     job_position = models.charfield(max_length=30, null=true, unique=true)  class job_posting(models.model):     fkey = models.foreignkey("job", verbose_name="job positions", unique=true) 

and admin:

class jobs(admin.tabularinline):      model = job_posting     readonly_fields = [ 'fkey',]     = 0  class applicant(admin.modeladmin):      model = job     list_display = ('job_position')     list_filter = ['job_position']     inlines = [jobs] 

is possible add list filter option inline? list_filter = ['job_position', 'job_posting.fkey'] or example, current list_filter have shows items under job_position(selecting job_position shows record have position) , want add option filtering job_position have specific job_posting.fkey while giving me option see records

can or it's not possible? or if there other options be? in advance.

edit

i need this, filtering job has job_posting, fkey in list_filter

i have found looking here, filter job through job_posting fkey, need add job_posting__fkey in list_filter looking this:

class applicant(admin.modeladmin):      model = job     list_display = ('job_position')     list_filter = ['job_position', 'job_posting__fkey']     inlines = [jobs] 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -