Re: Specifying model relationship as string vs concrete model class

2019-04-07 Thread Collin Anderson
models.Foreignkey(User) is a more pythonic and allows more better analysis by tools like flake8, but in some cases you need to create the ForeignKey before User is defined, so you _have_ to use a string. Example: https://docs.djangoproject.com/en/stable/ref/models/fields/#foreignkey On Sat, Apr 6

Re: Specifying model relationship as string vs concrete model class

2019-04-07 Thread Mohit Solanki
I know this group is for django development, posting it here because I want to here from core django devs. On Sunday, April 7, 2019 at 9:23:45 AM UTC+5:30, Mohit Solanki wrote: > > Since Django allows specifying relationship between models by both as a > string or by a model class > "models.Fore

Specifying model relationship as string vs concrete model class

2019-04-06 Thread Mohit Solanki
Since Django allows specifying relationship between models by both as a string or by a model class "models.Foreignkey('User') vs "models.Foreignkey(User)". Which one is preferred and recommend and what are the downsides of choosing one over the other? In documentation all the examples are of the se