ay, April 7, 2019 05:43
To: Django users
Subject: Specifying model relationship as string vs concrete model?
Since Django provides two ways of specifying model relationship,
models.ForeignKey('User') vs models.ForeignKey(User)
Which one is more preferred and recommended? Is there any u
Using the class means you have to import it first. I have stuck to the string
version since encountering circular import errors some time ago. Django is
smart enough to get it right so I don't even think about it.
YMMV
Mike
Connected by Motorola
Mohit Solanki wrote:
>Since Django provides t
Since Django provides two ways of specifying model relationship,
models.ForeignKey('User') vs models.ForeignKey(User)
Which one is more preferred and recommended? Is there any upside or
downside of choosing one over the other? In Django documentation, all the
example are of the second form bu
3 matches
Mail list logo