| | 268 | |
| | 269 | == unbound method contributee_to_class() == |
| | 270 | |
| | 271 | ==== Symptom ==== |
| | 272 | |
| | 273 | A model does not validate with the following message: |
| | 274 | |
| | 275 | {{{ |
| | 276 | Validating models... |
| | 277 | project.allication: Error when calling the metaclass bases |
| | 278 | unbound method contribute_to_class() must be called with TextField instance as first argument (got ModelBase instance instead) |
| | 279 | 1 error found. |
| | 280 | }}} |
| | 281 | |
| | 282 | ==== Possible Cause ==== |
| | 283 | |
| | 284 | A model field was not declared properly, the parentheses after the field types name were missing: |
| | 285 | |
| | 286 | wrong: |
| | 287 | {{{ |
| | 288 | #!python |
| | 289 | class Content(models.Model): |
| | 290 | content = models.TextField |
| | 291 | }}} |
| | 292 | |
| | 293 | correct: |
| | 294 | {{{ |
| | 295 | #!python |
| | 296 | class Content(models.Model): |
| | 297 | content = models.TextField() |
| | 298 | }}} |
| | 299 | |
| | 300 | ==== Solution ==== |
| | 301 | |
| | 302 | The field declaration are sonething like generator methods, so they need parentheses after their name. Add them and the model will validate. |