I'm a newbie to django world. While doing and academic project i'm required to implement tree structure in django.
The concept is to make a user hierarchy so that one use can come as subordinate of another user.
Here is my models.py
from django.db import models
from django.contrib.auth.models import User
import mptt
from mptt.models import MPTTModel, TreeForeignKey
class App_model(models.Model):
case_id = models.CharField(max_length=30)
p_stn= models.CharField(max_length=50)
case_description= models.TextField()
officer= models.ForeignKey(User)
date_created=models.DateTimeField(auto_now=True,auto_now_add=False)
class Testmptt(MPTTModel):
name = models.ForeignKey(App_model)
parent =TreeForeignKey('self',null=True,blank=True,related_name='children',db_index=True)
mptt.register(Testmptt)
My settings.py
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'debug_toolbar',
'mptt',
'django_mptt_admin',
My admin.py
from officerapp.models import App_model
from django_mptt_admin.admin import DjangoMpttAdmin
class App_modelAdmin(DjangoMpttAdmin):
pass
admin.site.register(App_model,App_modelAdmin)
Problem is that when i use admin interface it shows error while loading form the server.
Screenshot of this error is here in the following link.
Any one to help ?