Model has either not been installed or is abstract

When I try to migrate my code I get this error. Here are my code and classes:

from django.db import models
from core.models import Event

class TicketType(models.Model):
    name = models.CharField(max_length=45)
    price = models.DecimalField(max_length=2, decimal_places=2, max_digits=2)
    type = models.CharField(max_length=45)
    amount = models.IntegerField()
    event = models.ForeignKey(Event)

class Meta:
    app_label = "core"

import datetime
from django.core.serializers import json
from django.db import models
from core.models import User

class Event(models.Model):
    page_attribute = models.TextField()
    name = models.TextField(max_length=128 , default="New Event")
    description = models.TextField(default="")
    type = models.TextField(max_length=16)
    age_limit = models.IntegerField(default=0)
    end_date = models.DateTimeField(
    start_date = models.DateTimeField(
    is_active = models.BooleanField(default=False)
    user = models.ForeignKey(User)

    class Meta:
            app_label = "core"

Here is the error I get:

CommandError: One or more models did not validate: core.event: 'ticket_type' has a relation with model core.models.ticket_type.TicketType, which has either not been installed or is abstract.


You're unnecessarily confusing yourself by having these in separate files within the same app.

But your issue is caused by the way you're referenced the target model. You don't use the full module path to the model: you just use 'app_name.ModelName'. So in your case it should be:


Another issue can be when using multiple models in separate files missing statement like:

class Meta:
    app_label = 'core_backend'

You can also get this error if there a bug in your models file that prevents it from loading properly. For example, in

from third_party_module_i_havent_installed import some_method

I hit this error when I didn't put a third-party app in my INSTALLED_APPS setting yet.

Need Your Help

How to find cursor position in a contenteditable DIV?

javascript autocomplete contenteditable cursor-position

I am writing a autocompleter for a content editable DIV (need to render html content in the text box. So preferred to use contenteditable DIV over TEXTAREA). Now I need to find the cursor position ...

RODBC Temporary Table Issue when connecting to MS SQL Server

sql sql-server r rodbc

I am running R on unix and I am using the RODBC package to connect to MS SQL server. I can execute a query that returns results fine with the package, but if I use a temporary table somewhere in m...