[Answered ]-Django use model EmailField raising AttributeError

2👍

The problem is in this line:

    return self.email.lower().endsWith(".com")

The method is .endswith().
Please note the absence of camel-case.

A simplified example which reproduces the error:

>>> 'foo'.endsWith('test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'endsWith'

Leave a comment