Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISSUE-77 HOTFIX Save the resource after processing relationships #79

Conversation

ddobson
Copy link
Contributor

@ddobson ddobson commented Aug 29, 2019

Fixes issue #77 while preserving changes to fk relationships

Test

  1. Using a resource with a many-to-many relationship make a single PATCH request to an existing record. The body should update resource attributes and create/change linkages in the resources m2m relationship. Validate the following:

    • django.db.models.Model.save() is only called once (there should only be one DB UPDATE statement)
    • All resource attributes from the request have been updated appropriately and committed to the DB
    • The linkages in the m2m relationship should be changed appropriately and committed to the DB
  2. Repeat step one but this time with a resource that has a "to-one" relationship. The relationship many be "one-to-many" or "one-to-one" as both of these relationship types are set the same way in Django (attribute assignment). Validate the following:

    • django.db.models.Model.save() is only called once (there should only be one DB UPDATE statement)
    • All resource attributes from the request have been updated appropriately and committed to the DB
    • The linked "to-one" resource should be assigned appropriately and committed to the DB

- Prevents issues saving one-to-many relationships
Copy link

@brianrhyolite brianrhyolite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ddobson Code review looks good.

@MSBoone5 MSBoone5 self-assigned this Sep 4, 2019
Copy link

@MSBoone5 MSBoone5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code review looks good, will follow up with QA

@MSBoone5
Copy link

MSBoone5 commented Sep 5, 2019

QA Looks good

@ddobson ddobson merged commit 7018ee6 into master Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants