adjust citysite table name to activesites
This commit is contained in:
1 parent
fb0f996776
commit
64b37b6b6d
27 files changed
+382
-221
No files matched your search
@@ -5,7 +5,7 @@ from django.db import transaction
|
||||
|
||||
from apps.accounts.models import ApiKey, User
|
||||
from apps.farms.models import Site
|
||||
from apps.sync.models import CitySite
|
||||
from apps.sync.models import ActiveSite
|
||||
|
||||
|
||||
# Every executive role + inactive, for local HQ demos.
|
||||
@@ -108,13 +108,15 @@ class Command(BaseCommand):
|
||||
if not staff:
|
||||
return
|
||||
moved_sites = Site.objects.filter(user=staff).update(user=gm)
|
||||
moved_cities = CitySite.objects.filter(registered_by=staff).update(registered_by=gm)
|
||||
moved_active = ActiveSite.objects.filter(registered_by=staff).update(
|
||||
registered_by=gm
|
||||
)
|
||||
ApiKey.objects.filter(user=staff).delete()
|
||||
staff.delete()
|
||||
self.stdout.write(
|
||||
self.style.WARNING(
|
||||
f"Removed legacy staff login "
|
||||
f"(reassigned sites={moved_sites}, city_sites={moved_cities} to gm)"
|
||||
f"(reassigned sites={moved_sites}, active_sites={moved_active} to gm)"
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in new issue
Block a user