Ticket #23604: fix.patch

File fix.patch, 820 bytes (added by Emmanuelle Delescolle, 7 years ago)

Fix

  • django/contrib/admin/options.py

    commit d1b80c597fb2d539eca533434e7032dec2c16b90
    Author: Emmanuelle Delescolle <emma@lasolution.be>
    Date:   Sun Oct 5 16:05:41 2014 +0200
    
        fix
    
    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    index 6edae7a..61a17cb 100644
    a b class BaseModelAdmin(six.with_metaclass(forms.MediaDefiningClass)): 
    466466                    related_object.field.rel.get_related_field() == field):
    467467                return True
    468468
     469        # Check whether this model is the origin of a M2M relationship
     470        # in which case to_field has to be the pk on this model
     471        if len(opts.many_to_many) and field == opts.pk:
     472            return True
     473
     474
    469475        return False
    470476
    471477    def has_add_permission(self, request):
Back to Top