The Django docs state there are only two restrictions on model field names
- A field name cannot be a Python reserved word
- A field name cannot contain more than one underscore in a row
However, given the following example, it doesn't look like I can use the field name check
as a ForeignKey.
class Check(models.Model):
name = models.CharField(max_length=100)
class MyModel(models.Model):
# this works fine
#check = models.BooleanField()
# this breaks
check = models.ForeignKey(Check, on_delete=models.PROTECT, related_name='+')
Here's the error:
$ python manage.py check
SystemCheckError: System check identified some issues:
ERRORS:
myapp.MyModel: (models.E020) The 'MyModel.check()' class method is currently overridden by <django.db.models.fields.related_descriptors.ForwardManyToOneDescriptor object at 0x03A818D0>
Are the docs wrong, or am I doing something wrong?
Edit: forgot to mention this project is using Python 2 and Django 1.11