28👍
✅
When you define models with foreign keys, you can use the format:
tags = models.ManyToManyField('tags.Tag', ...)
This means you don’t need to have imported the Tag class, just installed the tags app.
Then you can store a function in a different location, that might import both Tag and Item, and not have to worry about circular imports.
Source:stackexchange.com