MCPcopy
hub / github.com/django/django / get_changelist_instance

Method get_changelist_instance

django/contrib/admin/options.py:905–949  ·  view source on GitHub ↗

Return a `ChangeList` instance based on `request`. May raise `IncorrectLookupParameters`.

(self, request)

Source from the content-addressed store, hash-verified

903 return ChangeList
904
905 def get_changelist_instance(self, request):
906 """
907 Return a `ChangeList` instance based on `request`. May raise
908 `IncorrectLookupParameters`.
909 """
910 list_display = self.get_list_display(request)
911 list_display_links = self.get_list_display_links(request, list_display)
912 # Add the action checkboxes if any actions are available.
913 # RemovedInDjango70Warning: When the deprecation ends, replace with:
914 # if self.get_actions(
915 # request, action_location=ActionLocation.CHANGE_LIST
916 # ):
917 if self._get_actions_with_action_location(
918 request, action_location=ActionLocation.CHANGE_LIST
919 ):
920 list_display = ["action_checkbox", *list_display]
921 sortable_by = self.get_sortable_by(request)
922 ChangeList = self.get_changelist(request)
923 list_select_related = self.get_list_select_related(request)
924 if list_select_related is True:
925 # RemovedInDjango70Warning: when the deprecation ends, remove the
926 # below 'if' clause and raise a ValueError here.
927 if self.list_select_related is not True:
928 warnings.warn(
929 "Returning True from ModelAdmin.get_list_select_related() is "
930 "deprecated. Return False or a list or tuple of fields to "
931 "fetch instead.",
932 RemovedInDjango70Warning,
933 )
934 return ChangeList(
935 request,
936 self.model,
937 list_display,
938 list_display_links,
939 self.get_list_filter(request),
940 self.date_hierarchy,
941 self.get_search_fields(request),
942 list_select_related,
943 self.list_per_page,
944 self.list_max_show_all,
945 self.list_editable,
946 self,
947 sortable_by,
948 self.search_help_text,
949 )
950
951 def get_object(self, request, object_id, from_field=None):
952 """

Calls 9

get_list_displayMethod · 0.95
get_changelistMethod · 0.95
get_list_filterMethod · 0.95
get_search_fieldsMethod · 0.95
ChangeListClass · 0.90
get_sortable_byMethod · 0.45