Re: Specifying model relationship as string vs concrete model?

2019-04-07 Thread PASCUAL Eric
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

Re: Specifying model relationship as string vs concrete model?

2019-04-06 Thread Mike Dewhirst
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

Specifying model relationship as string vs concrete model?

2019-04-06 Thread Mohit Solanki
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