Django Book 翻译
菜单>:
TOC
返回
原文:
.. table:: Table B-5. ForeignKey Options +-----------------------+----------------------------------------------------------------------------------+ |Argument |Description | +=======================+==================================================================================+ |``edit_inline`` |If not ``False`` , this related object is edited inline on the related objects | | |page. This means that the object will not have its own admin interface. Use either| | |``models.TABULAR`` or ``models.STACKED`` , which, respectively, designate whether | | |the inline-editable objects are displayed as a table or as a stack of fieldsets. | +-----------------------+----------------------------------------------------------------------------------+ |``limit_choices_to`` |A dictionary of lookup arguments and values (see Appendix C) that limit the | | |available admin choices for this object. Use this with functions from the Python | | |``datetime`` module to limit choices of objects by date. For example, the | | |following: | | | | | |:: | | | | | | | | | limit_choices_to = {'pub_date__lte': datetime.now} | | | | | |.. | | | | | | | | | | | |only allows the choice of related objects with a ``pub_date`` before the current | | |date/time to be chosen. | | | | | |Instead of a dictionary, this can be a ``Q`` object (see Appendix C) for more | | |complex queries. | | | | | |This is not compatible with ``edit_inline`` . | +-----------------------+----------------------------------------------------------------------------------+ |``max_num_in_admin`` |For inline-edited objects, this is the maximum number of related objects to | | |display in the admin interface. Thus, if a pizza could have only up to ten | | |toppings, ``max_num_in_admin=10`` would ensure that a user never enters more than | | |ten toppings. | | | | | |Note that this doesnt ensure more than ten related toppings ever get created. It | | |simply controls the admin interface; it doesnt enforce things at the Python API | | |level or database level. | +-----------------------+----------------------------------------------------------------------------------+ |``min_num_in_admin`` |The minimum number of related objects displayed in the admin interface. Normally, | | |at the creation stage, ``num_in_admin`` inline objects are shown, and at the edit | | |stage, ``num_extra_on_change`` blank objects are shown in addition to all | | |pre-existing related objects. However, no fewer than ``min_num_in_admin`` related | | |objects will ever be displayed. | +-----------------------+----------------------------------------------------------------------------------+ |``num_extra_on_change``|The number of extra blank related-object fields to show at the change stage. | +-----------------------+----------------------------------------------------------------------------------+ |``num_in_admin`` |The default number of inline objects to display on the object page at the add | | |stage. | +-----------------------+----------------------------------------------------------------------------------+ |``raw_id_admin`` |Only display a field for the integer to be entered instead of a drop-down menu. | | |This is useful when related to an object type that will have too many rows to make| | |a select box practical. | | | | | |This is not used with ``edit_inline`` . | +-----------------------+----------------------------------------------------------------------------------+ |``related_name`` |The name to use for the relation from the related object back to this one. See | | |Appendix C for more information. | +-----------------------+----------------------------------------------------------------------------------+ |``to_field`` |The field on the related object that the relation is to. By default, Django uses | | |the primary key of the related object. | +-----------------------+----------------------------------------------------------------------------------+
翻译:
6FzIoP
cfbillraxrtd
, [url=http://tykqzqebrnte.com/]tykqzqebrnte[/url], [link=http://usbunnmcfgzg.com/]usbunnmcfgzg[/link], http://jifonaxttcji.com/
备注:
译者: