I've created two new methods in models.py:
def test(self):
return 'Test'
However, after restarting apache and wsgi, I'm unable to use the methods in templates or in command line.
Instead I get 'Model doesn't have attribute 'test'
Has anyone seen this issue before? How did you resolve?
class ClientAppointmentMessage(models.Model):
# fields here
class Meta:
ordering = ['-created']
def __unicode__(self):
return self.appointment.creator.name
def get_absolute_url(self):
return '/appointment/{0}'.format(self.appointment.id)
def test(self):
return 'Test'
NOTES:
Template ignores the function completely (no errors, no result)
Shell throws 'ClientAppointmentMessage' has no attribute 'test'
I've ensured that I'm uploading file to correct directory.
I've tried '@property' above the method
I've restarted apache and wsgi
Example of shell commands:
from path.to.models import ClientAppointment, ClientAppointmentMessage
a = ClientAppointment.objects.get(id=1)
a.test() --> AttributeError: 'ClientAppointment has no attribute 'test''
a = ClientAppointmentMessage.objects.get(id=1)
a.test() --> AttributeError: 'ClientAppointmentMessage' has no attribute 'test'
a = ClientAppointmentMessage()
dir(a) --> shows list of methods, not including 'test' (this occurs both as property and as regular method)