1

I recently ported django 1.4 application to run with gunicorn. But after porting, few inline links do not appear in admin page. Is the issue related to admin CSS. Please help. I have attached the images.

This is with original django admin site - enter image description here

This is with gunicorn admin site (Note - 'Add another prod comp...' link is gone at bottom')

enter image description here

Snippet of 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

Snippet of 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)
Arovit
  • 3,579
  • 5
  • 20
  • 24
  • Can you post the relevant `admin.py` for that model and the inline model? – Timmy O'Mahony Feb 05 '14 at 14:47
  • @TimmyO'Mahony done. Can you please help ! I am stuck here – Arovit Feb 06 '14 at 13:33
  • 1
    Are there any javascript errors when you are on the admin pages? You might not have imported your static files correctly and therefore the javascript files might not be present. The "add an extra ..." button only appears when JS is enabled and working – Timmy O'Mahony Feb 06 '14 at 15:05

1 Answers1

0

Maybe this is related to statis files?

https://docs.djangoproject.com/en/1.6/howto/static-files/#serving-static-files-during-development

and here How to make Django serve static files with Gunicorn?

Community
  • 1
  • 1
eran
  • 6,731
  • 6
  • 35
  • 52