1

I have installed MPTT for Django, put it in "installed apps," set up my files, and synced my database. My model shows in admin, but when I click save after trying to add a category I get the following error:

DatabaseError at /admin/myapp/category/add/
relation "django_admin_log" does not exist
LINE 1: INSERT INTO "django_admin_log" ("action_time", "user_id", "c...

Here are my files:

Models:

from django.db import models
from django.contrib.auth.models import User
from mptt.models import MPTTModel, TreeForeignKey


class Category(MPTTModel):
    user = models.ForeignKey(User)
    name = models.CharField(max_length=30, unique=True)
    parent = TreeForeignKey('self', null=True, blank=True, related_name='children')

    class MPTTMeta:
        order_insertion_by = ['name']

    def __unicode__(self):
        return self.name

Admin:

from django.contrib import admin
from myapp.models import Category
from mptt.admin import MPTTModelAdmin

admin.site.register(Category, MPTTModelAdmin)
user2270029
  • 871
  • 14
  • 27

1 Answers1

1

Is it possible, that you've enabled the admin logs feature without running syncdb afterwards? Here you'll find a very similar question.

Community
  • 1
  • 1
Lukas Bünger
  • 4,257
  • 2
  • 30
  • 26