在我的django项目中缺少adminsortable模型模块

时间:2014-07-23 16:36:07

标签: python django django-cms

我的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

我从哪里获得这个模块?

1 个答案:

答案 0 :(得分:2)

不确定您尝试构建的内容。但似乎你错过了一个包裹。 认为你应该看看这个:https://github.com/iambrandontaylor/django-admin-sortable

非常确定那是你缺少的那个

pip install django-admin-sortable