Hi Markus,
Yes, you're right. When I started the tutorial I got the latest source from
github, but then I uninstalled and reinstalled 1.10 using pip. Something
remained from 1.11, perhaps in the database?
import datetime
from django.db import models
from django.utils import timezone
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __str__(self):
return self.choice_text
----
# -*- coding: utf-8 -*-
# Generated by Django 1.11.dev20160816211734 on 2016-08-18 04:05
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Choice',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('choice_text', models.CharField(max_length=200)),
('votes', models.IntegerField(default=0)),
],
options={
'indexes': [],
},
),
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(auto_created=True,
primary_key=True, serialize=False, verbose_name='ID')),
('question_text', models.CharField(max_length=200)),
('pub_date', models.DateTimeField(verbose_name='date
published')),
],
*options={*
* 'indexes': [],*
* },*
),
migrations.AddField(
model_name='choice',
name='question',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='polls.Question'),
),
]
Aha! Should've grepped the whole project for indexes. How do I "undo" this?
Thanks,
Dennis
On Monday, August 22, 2016 at 8:07:54 AM UTC-7, Markus Holtermann wrote:
>
> Hi Dennis,
>
> "indexes" is a new thing in the upcoming Django version. I'm fairly
> certain that you accidentially used Django's development version at some
> point while going through the tutorial.
>
> Could you please paste your models.py and the migration files Django
> created for you when you ran "manage.py makemigrations".
>
> /Markus
>
> On Sun, Aug 21, 2016 at 11:16:44PM -0700, Dennis Kornbluh wrote:
> >Going through the Django tutorial
> ><https://docs.djangoproject.com/en/1.10/intro/tutorial05/>, now at part
> 5,
> >section "Running tests". Followed the directions precisely, copy/pasted
> to
> >create polls/test.py, After running
> >
> >$ python manage.py test polls
> >
> >
> >got a stacktrace (http://dpaste.com/2XP5QZ7) ending with TypeError:
> 'class Meta' got invalid attribute(s): indexes
> >
> >
> >Totally stumped. Everything has worked up to this point.
> >
> >
> >
> >--
> >You received this message because you are subscribed to the Google Groups
> "Django users" group.
> >To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected] <javascript:>.
> >To post to this group, send email to [email protected]
> <javascript:>.
> >Visit this group at https://groups.google.com/group/django-users.
> >To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/4725f223-8a5e-4177-b5d2-b92d0fd416db%40googlegroups.com.
>
>
> >For more options, visit https://groups.google.com/d/optout.
>
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/eee1cc3b-6087-4de3-9040-3a2611b020b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.