2

我将 grappelli 用于 django 管理员。我有简单的博客模型:

class Blog(models.Model):
    title = models.CharField(max_length=100, unique=True)
    slug = models.SlugField(max_length=100, unique=True)
    body = models.TextField()
    timestamp=models.DateTimeField(db_index=True)
    category = models.ForeignKey('auto.Category')
    class Meta:
        ordering=('-timestamp',)

    class Category(models.Model):
    title = models.CharField(max_length=100, db_index=True)
    slug = models.SlugField(max_length=100, db_index=True)

管理员.py

class BlogInline(admin.TabularInline):
    list_display=('title', 'timestamp')
    prepopulated_fields = {'slug': ('title',)}
    model = Blog


class CategoryAdmin(admin.ModelAdmin):
    prepopulated_fields = {'slug': ('title',)}
    inlines = [BlogInline,]

admin.site.register(Category, CategoryAdmin)

在标准管理员中,我在类别中的每个博文附近都有删除复选框。但后来我打开 grappelli,这个复选框消失了。我怎样才能让他们回来?谢谢!

4

0 回答 0