Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/apps/profiles/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class UserAdmin(admin.ModelAdmin):


class DeletedUserAdmin(admin.ModelAdmin):
list_display = ('username', 'email', 'deleted_at')
list_display = ('user_id', 'username', 'email', 'deleted_at')
search_fields = ('username', 'email')
list_filter = ('deleted_at',)

Expand Down
18 changes: 18 additions & 0 deletions src/apps/profiles/migrations/0016_deleteduser_user_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 2.2.28 on 2025-02-04 16:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('profiles', '0015_deleteduser'),
]

operations = [
migrations.AddField(
model_name='deleteduser',
name='user_id',
field=models.IntegerField(blank=True, null=True),
),
]
7 changes: 6 additions & 1 deletion src/apps/profiles/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def all_objects(self):


class DeletedUser(models.Model):
user_id = models.IntegerField(null=True, blank=True) # Store the same ID as in the User table
username = models.CharField(max_length=255)
email = models.EmailField()
deleted_at = models.DateTimeField(auto_now_add=True) # Automatically sets to current time when the record is created
Expand Down Expand Up @@ -223,7 +224,11 @@ def delete(self, *args, **kwargs):
user_email = self.email # keep track of the email for the end of the procedure

# Store the deleted user's data in the DeletedUser table
DeletedUser.objects.create(username=self.username, email=self.email)
DeletedUser.objects.create(
user_id=self.id,
username=self.username,
email=self.email
)

# Github related
self.github_uid = None
Expand Down