nuBacuk
@nuBacuk
Python/Linux

Почему не получается добавить данные?

admin.py
# -*- coding: utf-8 -*-
from django.contrib import admin
from .models import Ingridient,Recipe

admin.autodiscover()

class QuestionAdmin(admin.ModelAdmin):
    fields = ['Recipe', 'Ingridient']

admin.site.register(Ingridient)
admin.site.register(Recipe)


models.py
# -*- coding: utf-8 -*-
from django.db import models

class Ingridient(models.Model):
    name = models.CharField(verbose_name = u'Ингридиент',max_length=30, unique=True)

    def __unicode__(self):
        return self.title

class Recipe(models.Model):
    name = models.CharField(verbose_name = u'Рецепт',max_length=30,unique=True)
    ingridients = models.ManyToManyField(Ingridient)

    def __unicode__(self):
        return self.title


Захожу в панель администратора, нажимаю добавить рецепт или ингридиент и выдает такую ошибку.
OperationalError at /admin/recipe/ingridient/add/

no such table: recipe_ingridient

Request Method: 	POST
Request URL: 	http://127.0.0.1:8000/admin/recipe/ingridient/add/
Django Version: 	1.8.5
Exception Type: 	OperationalError
Exception Value: 	

no such table: recipe_ingridient

Exception Location: 	/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py in execute, line 318
Python Executable: 	/usr/bin/python2.7


бд используется sqlite
  • Вопрос задан
  • 262 просмотра
Решения вопроса 1
zymanch
@zymanch
python/django web-developer
миграции-то сделаны?
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы