I have encountered an error while compiling code for a Django web application that I am writing
In console, it shows:
Validating models...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x028A2BB8>
The error tracking in the console up to where the error is in my program is
File "C:\Uni Work\R&D\yellowProject\teamList\models.py", line 9, in <module>
class UserTeamEntry(models.Model):
File "C:\Python34\lib\site-packages\django\db\models\base.py", line 144, in __new__
new_class.add_to_class(obj_name, obj)
File "C:\Python34\lib\site-packages\django\db\models\base.py", line 264, in add_to_class
value.contribute_to_class(cls, name)
TypeError: contribute_to_class() missing 1 required positional argument: 'name'
My models.py:
from django.db import models
from django.contrib.auth.models import User
class UserTeamEntry(models.Model):
user = models.OneToOneField(User)
position_choices = (('TEAMMEMBER', 'Team Member'),
('MANAGER', 'Manager'),)
userID = models.AutoField(primary_key = True)
userPosition = models.CharField(max_length = 10, choices = position_choices)
userShare = models.BooleanField
You just forget to add parentheses () after BooleanField. So, add them:
userShare = models.BooleanField()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With