D
D
dintear_koden2020-02-23 12:54:45
Django
dintear_koden, 2020-02-23 12:54:45

No such table error. How to fix it?

Hello! Faced this error: no such table index_author. It seems that everything was done correctly (done makemigrations, migrate, tried this command: python manage.py migrate --run-syncdb).

Файл models.py

from django.db import models

TITLE_CHOICES = [
    ('MR', 'Mr.'),
    ('MRS', 'Mrs.'),
    ('MS', 'Ms.'),
]

class Author(models.Model):
    name = models.CharField(max_length=100)
    title = models.CharField(max_length=3, choices=TITLE_CHOICES)

    def __str__(self):
        return self.title


Файл forms.py

from django.forms import ModelForm
from .models import Author

class AuthorForm(ModelForm):
    class Meta:
        model = Author
        fields = ['name', 'title']

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question