Django のモデルのコードに従う必要があります。
class User(models.Model):
username = models.CharField(max_length=50, unique=True)
password = models.CharField(max_length=15)
class Follows(models.Model):
user = models.ManyToManyField(User, related_name = 'Isread+')
follower = models.ManyToManyField(User, related_name = 'Reads+')
これを行おうとすると、エラーが発生します。
>>> from twitter.models import *
>>> u1 = User.objects.all()[0]
>>> u2 = User.objects.all()[1]
>>> Follows.objects.create(user = u1, follower = u2)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python33\lib\site-packages\django\db\models\manager.py", line 149, in create
return self.get_query_set().create(**kwargs)
File "C:\Python33\lib\site-packages\django\db\models\query.py", line 414, in create
obj = self.model(**kwargs)
File "C:\Python33\lib\site-packages\django\db\models\base.py", line 415, in __init__
raise TypeError("'%s' is an invalid keyword argument for this function" % list(kwargs)[0])
TypeError: 'follower' is an invalid keyword argument for this function
なぜこれが起こるのか誰にも分かりますか?事前にthx。