if IP address == <my ip address> then
' do nothing here
else
country_georedirect()
end if
Employees
的班级
models.py
然后我在class Employees(models.Model):
employee_id = models.CharField(verbose_name = _("Employee ID"), max_length=20, primary_key=True)
employee_name = models.CharField(verbose_name = _("Employee Name"), max_length=20)
department = models.CharField(verbose_name = _("Department"), max_length=100)
post = models.CharField(verbose_name = _("Post"), max_length=100)
admin.py
根据教程,Employee分支中应该有四个字段。但在我的情况下,只有一个名为class EmployeesAdmin(admin.ModelAdmin):
list_display = ('employee_id', 'employee_name', 'department', 'post')
的字段,就像我没有在Employees
中添加EmployeesAdmin
类一样。它出什么问题了?我错过了什么吗?
admin.py:
admin.py
答案 0 :(得分:7)
在admin.site中注册您的管理员,如: -
admin.site.register(ModelName, AdminName)
答案 1 :(得分:2)
在admin.py中声明EmployeesAdmin
课程后尝试以下操作:
admin.site.register(Employees, EmployeesAdmin)