【问题标题】:Inline links do not appear while running with gunicorn in django admin site在 django 管理站点中使用 gunicorn 运行时不会出现内联链接
【发布时间】:2014-03-01 23:46:44
【问题描述】:

我最近移植了 django 1.4 应用程序以使用 gunicorn 运行。 但是移植后,很少有内联链接不会出现在管理页面中。是与管理 CSS 相关的问题。请帮忙。我已附上图片。

这是原始的 django 管理站点 -

这是 gunicorn 管理网站(注意 - '添加另一个产品组合...'链接在底部消失了')

model.py 的片段

class Resource(models.Model):
    resource_id = models.AutoField(primary_key=True)
    proj_sub_category = models.CharField(max_length=135, blank=True)
    resource_prod_comp_view = models.ForeignKey(ResourceProdCompView)
    class Meta:
        db_table = u'resource'
        verbose_name_plural = "Resource Map (Product Component Association)"

    def __unicode__(self):
        return self.name

    def res__prod_list(self):
        return self.resource_prod_comp_view.prod_list

class ProdRelCompResourceMap(models.Model):
    prod_rel_comp_resource_map_id = models.AutoField(primary_key=True)
    resource = models.ForeignKey(Resource, related_name='prod_rel_comp_resource_map_resource', null=True, blank=True)
    product = models.ForeignKey(Product, related_name='prod_rel_comp_resource_map_product', null=True, blank=True)
    prod_rel_comp = models.ForeignKey(ProdRelComp, null=True, blank=True)
    class Meta:
        db_table = u'prod_rel_comp_resource_map'
        verbose_name_plural = "Resource Map (Product/Component Association)"

    def __unicode__(self):
        mycomp = self.prod_rel_comp.prod_comp.component.name
        self.name = self.product.name + '__' + mycomp
        return self.name

admin.py 的片段

class ProdRelCompResourceMapInline(admin.TabularInline):

    model = ProdRelCompResourceMap
    extra = 0

class ResourceAdmin(admin.ModelAdmin):
    save_as = True
    save_on_top = True

    fieldsets = ((None, {'fields': (('name', 'lname', 'fname'),
                 ('emp_code', 'emptype', 'manager_email'), (
                 'office_location', 'badge'), ('b_group_code',))}), )

    exclude = ['proj_sub_category','b_group','location',]

    list_display = (
        'name', 
        'res__prod_list',
        'emp_code',
        'emptype',
        'manager_email',
        'office_location',
        'fname',
        'lname',
        'b_group_code',
        'badge',
        )
    list_filter = ('emp_code', 'emptype', 'b_group_code', 'office_location')
    list_per_page = 100

    search_fields = ['name', 'proj_sub_category',]
    inlines = [ProdCompAttsResourceMapInline,]



admin.site.register(Resource, ResourceAdmin)

【问题讨论】:

  • 您能发布该模型和内联模型的相关admin.py 吗?
  • @TimmyO'Mahony 完成。你能帮忙吗!我被困在这里
  • 在管理页面上是否有任何 javascript 错误?您可能没有正确导入静态文件,因此 javascript 文件可能不存在。 “添加额外的...”按钮仅在启用 JS 并正常工作时出现

标签: python django gunicorn


【解决方案1】:
猜你喜欢
  • 2011-08-14
  • 2010-11-04
  • 1970-01-01
  • 2010-12-29
  • 1970-01-01
  • 2015-10-01
  • 1970-01-01
  • 2012-08-23
  • 2013-10-16
相关资源
最近更新 更多