Unhandled exception when checking models in Django

I am getting an error while compiling the code for a Django web app I am writing

The console displays:

Validating models...
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x028A2BB8>

      

Tracking errors in the console to where the error is in my program

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 .py models:

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

      

+3


source to share


1 answer


You will just forget to add parentheses () after BooleanField

. So add them:



userShare = models.BooleanField()

      

+7


source







All Articles