Fix file attachment updating.

Review Request #6511 — Created Oct. 26, 2014 and submitted

Information

Review Board
master
5890653...

Reviewers

When I pushed these changes, I had made a couple last-minute changes that
didn't end up completely committed to git, which meant that things were in a
relatively broken state. This change fixes two issues with file attachment
histories.

First, the attribute name when creating new file attachments had changed from
attachment_history_id to attachment_history. This was reflected in most
places but a couple didn't get the update.

Second, newly-created FileAttachmentHistory objects weren't being properly
associated with the right review request, which meant that future updates would
be rejected.

  • Created some new file attachments and then updated them.
  • Ran unit tests
Description From Last Updated

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

reviewbotreviewbot

I didn't notice this before, but why isn't this just set above in the create call?

chipx86chipx86
reviewbot
  1. Tool: Pyflakes
    Processed Files:
        reviewboard/reviews/models/base_review_request_details.py
        reviewboard/attachments/forms.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/views/uploadAttachmentView.js
    
    
    
    Tool: PEP8 Style Checker
    Processed Files:
        reviewboard/reviews/models/base_review_request_details.py
        reviewboard/attachments/forms.py
    
    Ignored Files:
        reviewboard/static/rb/js/resources/models/fileAttachmentModel.js
        reviewboard/static/rb/js/views/uploadAttachmentView.js
    
    
  2. reviewboard/attachments/forms.py (Diff revision 1)
     
     
    Show all issues
    Col: 80
     E501 line too long (81 > 79 characters)
    
  3. 
      
chipx86
  1. 
      
  2. Show all issues

    I didn't notice this before, but why isn't this just set above in the create call?

    1. ManyToMany relations can't be set in create()

    2. attachment_history is a ForeignKey.

    3. But the file_attachment isn't the thing being created, and you also can't set the many side of a foreign key in create()

    4. Oops, we're creating a History. Read that wrong, sorry!

  3. 
      
RM
  1. 
      
  2. reviewboard/attachments/forms.py (Diff revision 1)
     
     

    Yeah this is what I was imagining was necesarry to fix my problem.

  3. 
      
chipx86
  1. Ship It!

  2. 
      
david
Review request changed
Status:
Completed
Change Summary:
Pushed to master (baf3b8a)