[Fixed]-Django – Use one models primary key in another model

1👍

Ofcourse you can use it.

class User(models.Model):
    user = models.ForeignKey(settings.AUTH_USER_MODEL)
    verse = models.ForeignKey(Verse)

To access votes value you simply have to write:

User.verse.votes

0👍

you can use too:

models.ForeignKey('aplicationname.modelname')
👤Hetdev

Leave a comment