wrote:
>
> On 1 September 2016 at 11:55, James Beith >
> wrote:
> > By using a model name there are fewer imports at the top of the module
> and
> > fewer occurrences of circular import dependencies between Django
> > applications. What are the disadvantage
A ForeignKey field is often defined using the class to which the model is
related, for example.
from django.db import models
from authors.models import Author
class Post(models.Model):
author = models.ForeignKey(Author)
Alternatively the model name can be used, rather than the model class
2 matches
Mail list logo