Here's the issue I'm currently having:
- I'm running through the first django tutorial on Windows using Command Prompt
- I've created a table called 'Question' in models.py.
- I'm attempting to create a
__str__()function within this class like following:
.
from django.db import models
class Question(models.Model):
def __str__(self):
return self.question_text`
This is how my models.py looks:
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
The error I'm receiving is the following:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Python34\lib\site-packages\django\db\models\base.py", line 117, in __new__
kwargs = {"app_label": package_components[app_label_index]}
IndexError: list index out of range
Anyone got any idea? I'm a total noob to django, and I'm not 100% sure what base.py should be doing here.
Base.py can be found here: https://github.com/django/django/blob/master/django/db/models/base.py