dragon-fire-fly / developer_matcher

2 stars 1 forks source link

[BUG] Delete user profile not working #64

Closed dragon-fire-fly closed 1 year ago

dragon-fire-fly commented 1 year ago

Describe the bug When the delete profile button is pressed, an AttributeError is thrown. " 'User' object has no attribute 'profile_picture' "

To Reproduce Steps to reproduce the behavior:

  1. Go to profile -> 'http://127.0.0.1:8000/user/profile/'
  2. Click on 'delete profile'
  3. confirm delete in modal
  4. See error

Expected behavior The user account should be deleted and the user redirected to the home page with a successful deletion message.

Screenshots Screenshot from 2023-03-04 16-34-02

Desktop (please complete the following information):

dragon-fire-fly commented 1 year ago

This bug was caused by using the incorrect related name from the models.ForeignKey() field. The name should be "profile_pic", not "profile_picture. Buggy code: incorrect_related_name Fixed code: fixed_code

Successfully deleted profile after fix: successful_deletion