-
Notifications
You must be signed in to change notification settings - Fork 330
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
implementing manual logic of on_delete option in M2M models #1344
implementing manual logic of on_delete option in M2M models #1344
Conversation
@rithviknishad Review please! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are performing <QuerySet>.delete()
. However, we've overridden the <Instance>.delete()
to soft delete only.
Would <QuerySet>.delete()
call the overridden delete
method and soft delete or does it hard delete?
@yaswanthsaivendra also could you prefix the issue numbers with "Fixes" or other linking keywords? |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
🤦😅 hard delete, made changes to soft delete |
My bad, I did all changes in single commit 😮💨. Referenced the changes in each task. Please check it now! |
@sainak Please review this |
@sainak Can you review? |
Proposed Changes
Implementing on_delete logic in below M2M models as it doesnt work coz of our soft delete logic.
UserDefaultAssetLocation ( Implements soft delete logic on - AsseLocation , User )
FacilityDefaultAssetLocation ( Implements soft delete logic on - AssetLocation, Facility )
ConsultationBed ( Implements soft delete logic on - Bed, PatientConsultation )
FacilityUser ( Implements soft delete logic on - Facility , user, created_by )
InvestigationValue ( Implements soft delete logic on - PatientConsultation, PatientInvestigationGroup, PatientInvestigation, InvestigationSession )
PatientSample ( Implements soft delete logic on - PatientRegistration, PatientConsulation and set NULL to created_by, last_edited_by of User Model , Facility )
For relations having models.CASCADE and models.PROTECT - I implemented soft delete logic
For relations having models.SET_NULL - I set them to NULL
Associated Issue
@coronasafe/code-reviewers