DJANGO - Filter Data from two models -


i have 2 mysql models:

class registration(models.model):    name = models.charfield(max_length=30)    email = models.emailfield()    password = models.charfield(max_length=30)    company = models.charfield(max_length=30)   class personal_details(models.model):    reg = models.foreignkey(registration)    job = models.charfield(max_length=30)    experience = models.integerfield(default=0) 

i want filtering details using both experience , company keyword. want fetch , display details(name, email, company, job, experience) both tables in html page.

you can inside filter() should this

i'm working personal_details object now:

filteredresults = personal_details.objects.filter(experience="grasscutting", reg__company="ibm") 

this give list of objects found. magic here can access foreignkey relationships __ convention.


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -