I
I
Ilya2015-10-28 23:03:36
Django
Ilya, 2015-10-28 23:03:36

Why can't I add data?

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

I go to the admin panel, click add recipe or ingredient and give this error.
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

db is using sqlite

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Lebedev, 2015-10-28
@nuBacuk

migrations done?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question