Closed Bug 912916 Opened 11 years ago Closed 11 years ago

Bugs model behaviour on user delete

Categories

(Mozilla Reps Graveyard :: reps.mozilla.org, task)

task
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: nemo-yiannis, Unassigned)

Details

(Whiteboard: [kb=1104911] [good first bug][lang=python])

"Bug" model class under remozilla app has two foreign keys (creator, assigned_to) to "User" class [1]. Django's default behaviour on delete object with foreign key dependencies is to delete the dependencies as well [2]. This causes problems in the way we define bugs. For example a user who has created or is assigned to a bug gets deleted. This also deletes the bugs that might be useful to another user in the portal. A solution to that could be to set the foreign key values to NULL [3] [1] https://github.com/mozilla/remo/blob/master/remo/remozilla/models.py#L19 [2] https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.ForeignKey.on_delete [3] https://docs.djangoproject.com/en/dev/ref/models/fields/#django.db.models.SET_NULL
Group: mozilla-reps-admins
Whiteboard: [kb=1104911]
Whiteboard: [kb=1104911] → [kb=1104911] [good first bug][lang=python]
Correction: "Bug" model class under remozilla app has two foreign keys (creator, assigned_to) to "User" class [1]. Django's default behaviour when you delete an object which is referenced by a foreign key is to delete the objects containing the foreign key as well [2].
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
OS: Linux → All
Hardware: x86_64 → All
Version: unspecified → 413
Verified on stage. Thanks hardfire!
Status: RESOLVED → VERIFIED
Product: Mozilla Reps → Mozilla Reps Graveyard
You need to log in before you can comment on or make changes to this bug.