首页 > 技术文章 > 不同的应用程序间创建ManyToManyField

niucunguo 2021-10-15 09:19 原文

from django.db import models
from games.models import Game, Genre
from shots.utils import get_unique_slug
from django.utils import timezone

...

model for streamer

class Streamer(models.Model):
nick = models.CharField(max_length=30)
twitch = models.CharField(max_length=70)
games = models.ManyToManyField('games.Game')
...

推荐阅读