n00b
n00b

Reputation: 209

what exactly is related_name in django? where is the backward relationship located?

class Comment(models.Model):

user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='st_comments')

I have the above class in models.py .

related_name

has the backward relationship to what? st_comments?

What exactly is st_comments and where is it located and how is it related? Is it a field entry in another class?

If you need more info please check this

I've been through this and this

Upvotes: 0

Views: 59

Answers (1)

GwynBleidD
GwynBleidD

Reputation: 20539

st_comments will be located inside User model (or other model provided in settings.AUTH_USER_MODEL) and it will contain queryset to all comments assigned to particular user.

Upvotes: 2

Related Questions