django - Get related_name between two models -


how can programmatically related_name or related_query_name django model model?

for example, in code how can name parent uses reference child with?

class parent(models.model):     title = models.charfield(max_length=10)   class child(parent):     parent = models.onetoonefield(to=parent, parent_link=true)     description = models.textfield() 

you can use following finding out related_query_name:

child.parent.field.related_query_name() 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -