Django Help: AttributeError: 'module' object has no attribute 'Charfield'


Question

I have seen several similar posts of other attributes found but not this. New to Python and Django- I've done the first part of the several tutorials including Django's "Polls" tutorial and when it gets to the point where I syncdb for my app I invariably get 'AttributeError: 'module' object has no attribute CharField.

In models I have copied exactly as the tutorial says:

from django.db import models

class Poll(models.Model):
    question = models.Charfield(max_length=200)
    pub_date = models.DateTimeField('date published')
class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice = models.CharField(max_length=200)
    votes = models.IntegerField()
# Create your models here.

'polls' is also added to installed apps and I'm using sqlite3, windows 7, python 2.7.

Any help very appreciated! (I'm trying very hard to learn!)

1
9
6/22/2012 9:32:07 PM

That is CharField, with uppercase 'f', and not Charfield as in your code.

42
6/22/2012 9:35:37 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon