Error while doing migrations for a new table

71 views
Skip to first unread message

Mohamed Ghariani

unread,
Apr 18, 2017, 8:12:05 AM4/18/17
to Django developers (Contributions to Django itself)
Hello,
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)


After running  ./manage.py makemigrations i got this error

django.db.utils.OperationalError: no such table: app_app

Mohamed Ghariani

unread,
Apr 19, 2017, 7:08:48 AM4/19/17
to Django developers (Contributions to Django itself)
I created a bug on code.djangoproject.com

Ramiro Morales

unread,
Apr 19, 2017, 7:15:01 AM4/19/17
to django-d...@googlegroups.com
On Tue, Apr 18, 2017 at 6:52 AM, Mohamed Ghariani <ghariani....@gmail.com> wrote:
Hello,
I tried to apply migrations for a new model. The model was used in a form used in the admin so the migrations failed.

Please don't post questions like this (about using Django) to this list (its topic is about developing Django). Use the django-users or the #django IRC channel list for that. 


Regards,

--
Ramiro Morales
@ramiromorales
Reply all
Reply to author
Forward
0 new messages