-
-
Save mrobers1982/ac349456c68226263295 to your computer and use it in GitHub Desktop.
FSD - remove first/last name data fix
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
import time, datetime | |
def reset_name(domain): | |
counter = 0 | |
throttle = 0.07 | |
start_time = datetime.datetime.now() | |
while(True): | |
users = UserProfile.objects.filter(domain=d).exclude(first_name=None, last_name=None)[:10000] | |
if len(users) == 0: | |
break | |
for u in users: | |
print "Removing first/last name for user: %s" % (u.jid) | |
u.first_name = None | |
u.last_name = None | |
u.save() | |
counter += 1 | |
if counter % 10 == 0: | |
time.sleep(throttle) | |
end_time = datetime.datetime.now() | |
print 'Duration: %s' % str(end_time - start_time) | |
d = Domain.objects.get(id=136) | |
reset_name(d) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment