我有一个TabularInline
已添加到管理类中。内联在管理视图中显示“确定”,但是“添加更多”链接未显示
我已经检查了JS已100%启用,因为根据Django文档,这可能是一个问题。
我还检查了,加载任何标准JS文件时没有控制台错误或网络错误。
我更改了Inline类中的max_num,min_num和其他变量,但没有任何改变
admin.py:
from django.contrib import admin
from django.forms.models import BaseInlineFormSet
from .models import Evaluation, MV1_test
class MV1test(admin.TabularInline):
extras=3
max_num=5
model = MV1_test
verbose_name = 'MV1 Test'
verbose_name_plural = 'MV1 Tests'
class evaluationAdmin(admin.ModelAdmin):
save_on_top=True
fieldsets=(
('General',{
'fields':(('view_link'),('rma_number','evaluation_status','customer_name','customer_email','order_number','serial_number','firmware'),('evaluator','evaluation_date','replacement'))
}),
('Visual Evaluation',{
'fields':(
('condition_heatsink',
'heatsink_notes'),
('condition_stem',
'stem_notes'),
('condition_oven',
'oven_notes'),
('condition_door',
'door_notes'),
('condition_matte_uv',
'matte_uv_notes'),
('condition_plating',
'plating_notes'),
('condition_bypass',
'bypass_notes'),
('condition_coil',
'coil_notes')),
}),
('App Evaluation',{
'fields':(
('ghost_app_connection','ghost_app_connection_notes'),
('ble_connection', 'ble_connection_notes'),
('firmware_update_connection','firmware_update_connection_notes')
)
}),
('Haptic Evaluation',{
'fields':(
('vape_button_haptic','vape_button_haptic_notes'),
('power_button_haptic', 'power_button_haptic_notes'),
)
}),
('Battery Evaluation',{
'fields':(
('usb_charge','usb_charge_notes'),
('fast_charger_charge', 'fast_charger_charge_notes'),
('battery_removal','battery_removal_notes')
)
}),
('Over Door Evaluation',{
'fields':(
('door_sensor','door_sensor_notes'),
('latch_spring', 'latch_spring_notes'),
('oven_door','oven_door_notes'),
)
}),
('Performance',{
'fields':(
('taste_performance','taste_performance_notes'),
('odor_performance', 'odor_performance_notes'),
)
}),
('ABV',{
'fields':(
('abv_pic',
'abv_thumbnail'),
('abv_notes'),
)
}),
('Evaluation Summary',{
'fields':(
('evaluation_summary'),
)
})
)
inlines=[MV1test]
search_fields = ('serial_number', 'customer_name','customer_email','evaluator__username')#__username means look up the field from the FK
list_filter=['evaluation_date','evaluator']
list_display=('rma_number','serial_number','evaluator','customer_name','customer_email','replacement')
def get_readonly_fields(self, request, obj=None):
if obj: # obj is not None, so this is an edit
return ['evaluator','abv_thumbnail','evaluation_date','view_link'] # Return a list or tuple of readonly fields' names
else: # This is an addition
return ['abv_thumbnail','view_link']
admin.site.register(Evaluation, evaluationAdmin)
我希望在内联部分下方(在管理员视图中)看到“添加更多”链接,但没有链接。另外,如果我将Extra设置为= 3,则应该出现3个内联实例,但只有1个出现:
What the inline looks like in admin
在extra
设置为3的情况下,视图中至少应显示3个内联线