我有模特:
class User(models.Model):
title = models.CharField(max_lenght=100)
regions = model.ManyToMany(Region, through=UserRegion)
class UserRegion(models.Model):
user = models.ForeignKey(User)
region = models.FareignKey(Region)
class Region(models.Model):
title = models.CharField(max_lenght=100)
我想确定默认的方法。这意味着我想要像这样使用用户:
user.regions.set(Region.objects.all()[:3])
我该怎么做?