first commit

This commit is contained in:
Beyhan Oğur
2026-04-26 22:22:29 +03:00
commit ec28a2024d
208 changed files with 23836 additions and 0 deletions

65
restore_user_setup.sh Normal file
View File

@@ -0,0 +1,65 @@
#!/bin/bash
# Restore sonrası kullanıcı oluşturma scripti
cd /Users/beyhan/Projeler/Python/dj52
echo "==================================="
echo "RESTORE SONRASI KULLANICI OLUŞTURMA"
echo "==================================="
# Mevcut kullanıcıları kontrol et
python manage.py shell -c "
from accounts.models import CustomUser
users = CustomUser.objects.all()
print(f'\nToplam {users.count()} kullanıcı var')
for user in users:
print(f' - {user.email} (Staff: {user.is_staff}, Superuser: {user.is_superuser})')
"
echo ""
echo "Yeni superuser oluşturmak ister misiniz? (y/n)"
read -r answer
if [ "$answer" = "y" ]; then
echo "Email:"
read -r email
echo "Şifre:"
read -rs password
python manage.py shell -c "
from accounts.models import CustomUser
try:
user = CustomUser.objects.create_superuser(email='$email', password='$password')
print(f'\n✓ Superuser oluşturuldu: {user.email}')
except Exception as e:
print(f'\n✗ Hata: {e}')
"
fi
echo ""
echo "Mevcut bir kullanıcının şifresini değiştirmek ister misiniz? (y/n)"
read -r answer2
if [ "$answer2" = "y" ]; then
echo "Kullanıcı email:"
read -r user_email
echo "Yeni şifre:"
read -rs new_password
python manage.py shell -c "
from accounts.models import CustomUser
try:
user = CustomUser.objects.get(email='$user_email')
user.set_password('$new_password')
user.save()
print(f'\n✓ Şifre değiştirildi: {user.email}')
except CustomUser.DoesNotExist:
print('\n✗ Kullanıcı bulunamadı')
except Exception as e:
print(f'\n✗ Hata: {e}')
"
fi
echo ""
echo "İşlem tamamlandı!"