Opened 19 years ago
Closed 19 years ago
#1150 closed defect (invalid)
The custom method does not work
Reported by: | anonymous | Owned by: | Adrian Holovaty |
---|---|---|---|
Component: | Core (Other) | Version: | 0.90 |
Severity: | major | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
from django.core import meta
class Tescik(meta.Model):
... name = meta.CharField(maxlength=255)
... order = meta.IntegerField(null=True)
... def hello(self):
... return "Hello WORLD!"
...
from django.models.biblia import tesciks
print dir(tesciks)
['AddManipulator', 'ChangeManipulator', 'Klass', 'Tescik', 'TescikDoesNotExist', 'doc', 'file', 'name', '_get_sql_clause', 'get_count', 'get_in_bulk', 'get_iterator', 'get_list', 'get_object', 'get_values', 'get_values_iterator']
tesciks.hello
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
AttributeError: 'module' object has no attribute 'hello'
Attachments (1)
Change History (2)
by , 19 years ago
comment:1 by , 19 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
There's a distinction between "module-level" methods and "class-level" methods. See http://www.djangoproject.com/documentation/model_api/#module-level-methods