路由分发的好处

        为什么不把需要展示字段放在注册表当中,这样就可以直接调用展示,而是放在注册时实例化的模型当中,掉调用函数的时候,想用哪个就直接调用即可,但是这种方法使得代码重复性高,违背代码设计原则

       这样违背了解耦原则,

    list_display = ('__str__',)
    list_display_links = ()
    list_filter = ()
    list_select_related = False
    list_per_page = 100
    list_max_show_all = 200
    list_editable = ()
    search_fields = ()
    date_hierarchy = None
    save_as = False
    save_as_continue = True
    save_on_top = False
    paginator = Paginator
    preserve_filters = True
    inlines = []

    # Custom templates (designed to be over-ridden in subclasses)
    add_form_template = None
    change_form_template = None
    change_list_template = None
    delete_confirmation_template = None
    delete_selected_confirmation_template = None
    object_history_template = None
    popup_response_template = None

    # Actions
    actions = []
    action_form = helpers.ActionForm
    actions_on_top = True
    actions_on_bottom = False
    actions_selection_counter = True
    checks_class = ModelAdminChecks

        为什么把变量直接放在__init__当中,而不是放在列表当中,在列表当中读取数据不方便,不直观,而放在self当中,则简洁明了,想看那个就看那个.

原文地址:https://www.cnblogs.com/AbnerLc/p/11179726.html