Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

_set in django

# Now, given object e of type Entry, you would do e.blog to access 
# the related object Blog - which is a forward relation. 

class Blog(models.Model):
    pass

class Entry(models.Model):
    blog = Blog(..)

# The _set is a reverse lookup class variable django puts in for you.    
# So, given object b - you would do:
entries = b.entry_set.all()
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django
ADD COMMENT
Topic
Name
3+1 =