Changes between Version 29 and Version 30 of NewbieMistakes


Ignore:
Timestamp:
Nov 11, 2006, 3:12:57 PM (18 years ago)
Author:
dazer017@…
Comment:

Searched for hours to find this mistake, nobody else should suffer like me...

Legend:

Unmodified
Added
Removed
Modified
  • NewbieMistakes

    v29 v30  
    266266
    267267Rename your application directory using a non-reserved name, i.e., "email_app" instead of "email". Go into the {{{INSTALLED_APPS}}} section of settings.py and change the name there too. Also, don't forget to do a syncdb to create the newly renamed app in your database. You may also want to go in to your database and drop the old "mis-named" table.
     268
     269== unbound method contributee_to_class() ==
     270
     271==== Symptom ====
     272
     273A model does not validate with the following message:
     274
     275{{{
     276Validating models...
     277project.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)
     2791 error found.
     280}}}
     281
     282==== Possible Cause ====
     283
     284A model field was not declared properly, the parentheses after the field types name were missing:
     285
     286wrong:
     287{{{
     288#!python
     289class Content(models.Model):
     290    content = models.TextField
     291}}}
     292
     293correct:
     294{{{
     295#!python
     296class Content(models.Model):
     297    content = models.TextField()
     298}}}
     299
     300==== Solution ====
     301
     302The field declaration are sonething like generator methods, so they need parentheses after their name. Add them and the model will validate.
Back to Top