Answer the question
In order to leave comments, you need to log in
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)
# -*- 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
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question