﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28098	Error while doing migrations for a new model that is used in an form in the admin.py	GHARIANI Mohamed	nobody	"I tried to apply migrations for a new model. The model was used in a form used in the admin so the migrations failed.

He is a sample code i wrote which gave me the same errors.

models.py

{{{
from django.db import models

class App(models.Model):
    name = models.CharField(max_length=50)

}}}

forms.py

{{{
from django import forms

from app.models import App


class AppForm(forms.ModelForm):
    name = ((elem.id, elem.name ) for elem in App.objects.all())

}}}

admin.py

{{{
from django.contrib import admin

from app.forms import AppForm
from app.models import App

class AppAdmin(admin.ModelAdmin):
    search_fields = ('id', 'name')
    form = AppForm
    list_display = ('id', 'name')

admin.site.register(App, AppAdmin)

}}}

While running  ./manage.py makemigrations i got this error

{{{
django.db.utils.OperationalError: no such table: app_app
}}}
"	Bug	closed	Migrations	1.8	Normal	invalid	migrations		Unreviewed	0	0	0	0	0	0
