-1
我想註冊我爲我的項目製作的模型..在運行時給我的錯誤「name'rj_rootAdmin'未定義」我正在嘗試註冊模型和modelAdmin類。它工作時,我不註冊modelAdmin它的作品。請幫助我,我錯了。 TopologyAdmin沒有問題error註冊模型和模型管理員
from django.contrib import admin
from Input.models import Topology, rj_root
class TopologyAdmin(admin.ModelAdmin):
fieldsets = [
('Info', {'fields': ['Physical_id','Date','User'], 'classes': ['collapse']}),
('Link_start Information', {'fields': ['Start_node','Start_port'], 'classes': ['collapse']}),
('Link_end Information', {'fields': ['End_node','End_port'], 'classes': ['collapse']}),
('Data', {'fields': ['Stm_type','Technology','Status'], 'classes': ['collapse']}),
]
class rj_rootAdmin(admin.ModelAdmin):
fieldsets = [
('Info', {'fields': ['Date','User','Path_id','Service_type','User_label'], 'classes': ['collapse']}),
('Link Information', {'fields': ['Source_node','Source_port','Destination_node','Destination_port'], 'classes': ['collapse']}),
('Link Details', {'fields': ['Working_state','Service_rate','Protection','Card','Port','K','L','M'], 'classes': ['collapse']}),
('Intermediate link info', {'fields': ['I1_node','I1_port','I2_node','I2_port','I3_node','I3_port','I4_node','I4_port','I5_node', 'I5_port', 'I6_node','I6_port','I7_node','I7_port','I8_node','I8_port','I9_node','I9_port','I10_port','I10_port','I11_node','I11_port','I12_node', 'I12_port', 'I13_node','I13_port','I14_node','I14_port','I15_node','I15_port','I16_node','I16_port','I17_node','I17_port','I18_node','I18_port','I19_node', 'I19_port','I20_node','I20_port','I21_node','I21_port','I22_node','I22_port','I23_node','I23_port','I24_node','I24_port','I25_node', 'I25_port'], 'classes': ['collapse']}),
]
admin.site.register(Topology, TopologyAdmin)
admin.site.register(rj_root, rj_rootAdmin)
你檢查了你的縮進嗎?在你的例子中這是不正確的。 – Leticia 2014-11-04 07:39:51