Ticket #33911: 0001-Add-BaseAdmin.get_raw_id_fields-hook.patch

File 0001-Add-BaseAdmin.get_raw_id_fields-hook.patch, 956 bytes (added by Ivan Dominic Baguio, 2 years ago)

Patch that implements the requested feature

  • django/contrib/admin/options.py

    From 2c927df5baf4242205c3cc9c426a13e3a5b0d929 Mon Sep 17 00:00:00 2001
    From: ibaguio <baguio.ivan@gmail.com>
    Date: Wed, 10 Aug 2022 10:55:08 +0800
    Subject: [PATCH] Add BaseAdmin.get_raw_id_fields hook
    
    ---
     django/contrib/admin/options.py | 7 +++++++
     1 file changed, 7 insertions(+)
    
    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    index 8ccacd6213..52e093e87b 100644
    a b class BaseModelAdmin(metaclass=forms.MediaDefiningClass):  
    337337        """
    338338        return self.autocomplete_fields
    339339
     340    def get_raw_id_fields(self, request):
     341        """
     342        Return a list of ForeignKey and/or ManyToMany fields which should use
     343        a raw id widget.
     344        """
     345        return self.raw_id_fields
     346
    340347    def get_view_on_site_url(self, obj=None):
    341348        if obj is None or not self.view_on_site:
    342349            return None
Back to Top