Ticket #16089: inlines.diff

File inlines.diff, 2.4 KB (added by sheep2, 13 years ago)

git style diff created by hg

  • contrib/admin/options.py

    # HG changeset patch
    # User Dan Yang <daniel.yang@srtsolutions.com>'
    # Date 1306256948 14400
    # Node ID d3202affed8ac2d88ba8be790a7a364528bf2611
    # Parent  3683441f83c6296c1d47aa31a51bbde36a469d95
    Changes made to contrib/admin/options.py
    
    diff --git a/contrib/admin/options.py b/contrib/admin/options.py
    a b  
    299299                    break
    300300        super(ModelAdmin, self).__init__()
    301301
     302    def unregister_inline_instance(self, inline_class):
     303        ## Inefficient search for instance
     304        for inline_instance in self.inline_instances:
     305            if inline_instance.__class__ == inline_class:
     306                self.inline_instances.remove(inline_instance)
     307
     308    def register_inline_instance(self, inline_class):
     309        ## Inefficient search for instance
     310        for inline_instance in self.inline_instances:
     311            if inline_instance.__class__ == inline_class:
     312                return
     313        inline_instance = inline_class(self.model, self.admin_site)
     314        self.inline_instances.append(inline_instance)
     315
    302316    def get_urls(self):
    303317        from django.conf.urls.defaults import patterns, url
    304318
Back to Top