forked from Kamva-Academy/Kamva-Backend
-
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.
feat: add a command to get all shad users info
- Loading branch information
1 parent
2c6beec
commit 7c67fc6
Showing
1 changed file
with
22 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from django.core.management import BaseCommand | ||
|
||
from apps.accounts.models import User | ||
from proxies.Shad import get_user_data_from_shad, update_user_info_by_shad_data | ||
|
||
|
||
class Command(BaseCommand): | ||
|
||
def handle(self, *args, **options): | ||
for user in User.objects.filter(origin='SHAD', is_temporary=True): | ||
try: | ||
user_data = get_user_data_from_shad( | ||
user_uuid=user.username, | ||
landing_id=284, | ||
) | ||
update_user_info_by_shad_data(user, user_data) | ||
user.is_temporary = False | ||
user.save() | ||
except: | ||
pass | ||
|
||
self.stdout.write(self.style.SUCCESS('update all shad users')) |