-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Feat] #47 회원탈퇴구현
- Loading branch information
Showing
13 changed files
with
218 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
from django.core.management import call_command | ||
|
||
def send_return_reminder_email(): | ||
call_command('send_return_reminders') | ||
def send_return_reminders(): | ||
call_command('send_return_reminders') | ||
|
||
def delete_withdrawal_records(): | ||
call_command('delete_expired_withdrawal_records') |
17 changes: 17 additions & 0 deletions
17
home/management/commands/delete_expired_withdrawal_records.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.utils import timezone | ||
from users.models import WithdrawalRecord | ||
from datetime import datetime | ||
|
||
|
||
class Command(BaseCommand): | ||
help = '만료된 회원탈퇴 기록 지우기' | ||
|
||
def handle(self, *args, **options): | ||
print("[", datetime.now().strftime("%Y-%m-%d %H:%M:%S"), "]") | ||
try: | ||
expired_records = WithdrawalRecord.objects.filter(expiration_date__lte=timezone.now()) | ||
num_deleted, _ = expired_records.delete() | ||
print(f'{num_deleted} 개의 만료된 회원탈퇴 기록이 삭제되었습니다.') | ||
except Exception as e: | ||
print(f'회원탈퇴 기록 삭제 중 에러 발생: {e}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Generated by Django 5.0.1 on 2024-05-12 23:42 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('mypage', '0003_initial'), | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='umbrellareport', | ||
name='user', | ||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.0.1 on 2024-04-22 22:12 | ||
|
||
import datetime | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('umbrella', '0003_alter_rent_return_due_date'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='rent', | ||
name='return_due_date', | ||
field=models.DateTimeField(default=datetime.datetime(2024, 4, 25, 22, 12, 37, 10220)), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 5.0.1 on 2024-05-12 23:42 | ||
|
||
import datetime | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('umbrella', '0004_alter_rent_return_due_date'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='rent', | ||
name='return_due_date', | ||
field=models.DateTimeField(default=datetime.datetime(2024, 5, 15, 23, 42, 54, 658653)), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Generated by Django 5.0.1 on 2024-05-12 23:42 | ||
|
||
import datetime | ||
import django.utils.timezone | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0002_profile_fcm_token'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='WithdrawalRecord', | ||
fields=[ | ||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('studentID', models.IntegerField(default=0, unique=True)), | ||
('withdrawal_reason', models.CharField(choices=[('수량', '우산 수량이 적어서 사용을 잘 안해요.'), ('관리', '우산 관리가 잘 안되어 사용할 수 없어요.'), ('새계정', '새 계정을 만들고 싶어요.'), ('기타', '기타사항 (직접 입력)')], max_length=10)), | ||
('description', models.TextField(blank=True, max_length=200, null=True)), | ||
('withdrawal_date', models.DateTimeField(default=django.utils.timezone.now)), | ||
('expiration_date', models.DateTimeField(default=datetime.datetime(2024, 5, 19, 23, 42, 54, 660042))), | ||
], | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
#users/urls.py | ||
from django.urls import path | ||
from .views import SignUpView, LoginView, LogoutView, ProfileView | ||
from .views import SignUpView, LoginView, LogoutView, ProfileView, DeleteAccountView | ||
|
||
urlpatterns = [ | ||
path('signup/', SignUpView.as_view()), | ||
path('login/', LoginView.as_view()), | ||
path('logout/', LogoutView.as_view()), | ||
path('profile/<int:user_id>/', ProfileView.as_view()), | ||
path('withdrawal/', DeleteAccountView.as_view()), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters