我的models.py文件中有以下几行:
from django.core.urlresolvers import reverse
from django.db import models
from adminsortable.models import Sortable
from cms.models.fields import PlaceholderField
from filer.fields.image import FilerImageField
class StaffMember(Sortable):
class Meta:
app_label = 'staff'
full_name = models.CharField(u'full name',
blank=False,
default='',
help_text=u'Please enter a full name for this staff member',
max_length=64,
unique=True,
)
slug = models.SlugField(u'slug',
blank=False,
default='',
help_text=u'Provide a unique slug for this staff member',
max_length=64,
)
seniority = models.ForeignKey('staff.Seniority',
blank=True,
default=None,
help_text=u'Please specify a seniority level for this staff member',
null=True
)
photo = FilerImageField(
blank=True,
help_text=u'Optional. Please supply a photo of this staff member.',
null=True,
on_delete=models.SET_NULL, # Important
)
bio = PlaceholderField('staff_bio')
def absolute_url(self):
return reverse('staff:staffmember_detail', kwargs={'slug': self.slug, })
def __unicode__(self):
return self.full_name
当我执行syncdb时,我收到此错误:
File "/home/abhishek/workspace/djangocms/staff/models.py", line 6, in <module>
from adminsortable.models import Sortable
ImportError: No module named adminsortable.models
我从哪里获得这个模块?
答案 0 :(得分:2)
不确定您尝试构建的内容。但似乎你错过了一个包裹。 认为你应该看看这个:https://github.com/iambrandontaylor/django-admin-sortable
非常确定那是你缺少的那个
pip install django-admin-sortable