Fix m2m relationships from extensions to built-in models.

Review Request #6224 — Created Aug. 13, 2014 and discarded

Information

Djblets
release-0.8.x

Reviewers

Django caches a bunch of field information so when we side load our
extension Models any relationships added will not be propogated to the
related Model. This will cause problems where something tries to access
the related name of the extension Model from the built-in Model.

We now flush the caches on the related built-in Models when enabling
an extension.

Tested using the AutomaticRunGroup Model in Review Bot which relates
to the Repository Model. The admin interface for changing the
AutomaticRunGroup entry now loads properly.

Description From Last Updated

Extensions can include a list of apps they provide as well (Extension.apps). We should include those in the list of …

chipx86chipx86

We should include the module path for the model.

chipx86chipx86

Col: 80 E501 line too long (124 > 79 characters)

reviewbotreviewbot

That's kind of a scary line. Let's pull things out into a list, and then iterate. I'd prefer this format: …

chipx86chipx86

Col: 80 E501 line too long (87 > 79 characters)

reviewbotreviewbot

Included this comment for context right here, but it's stolen verbatim from the django source code. I will be removing …

SM smacleod

Col: 80 E501 line too long (86 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (88 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (81 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (86 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (85 > 79 characters)

reviewbotreviewbot

Col: 80 E501 line too long (85 > 79 characters)

reviewbotreviewbot
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        djblets/extensions/manager.py
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        djblets/extensions/manager.py
    
    
  2. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (124 > 79 characters)
    
  3. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (87 > 79 characters)
    
  4. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (86 > 79 characters)
    
  5. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (88 > 79 characters)
    
  6. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  7. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (86 > 79 characters)
    
  8. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (85 > 79 characters)
    
  9. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (85 > 79 characters)
    
  10. 
      
SM
  1. 
      
  2. djblets/extensions/manager.py (Diff revision 1)
     
     
     
     
     
     
     
     
    Show all issues

    Included this comment for context right here, but it's stolen verbatim from the django source code. I will be removing this in the next post for legal reasons.

  3. 
      
chipx86
  1. Do we know if ForeignKeys were also impacted by this bug?

  2. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues

    Extensions can include a list of apps they provide as well (Extension.apps). We should include those in the list of model modules.

  3. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues

    We should include the module path for the model.

  4. djblets/extensions/manager.py (Diff revision 1)
     
     
    Show all issues

    That's kind of a scary line. Let's pull things out into a list, and then iterate.

    I'd prefer this format:

    model_classes = [
        cls
        for name, cls in inspect....
        if inspect....
    ]
    
  5. 
      
david
Review request changed
Status:
Discarded