upgrade_20180404.py 640 B

123456789101112131415161718192021222324252627
  1. # -*- coding: utf-8 -*-
  2. #!/usr/bin/env python
  3. import os
  4. import sys
  5. import hashlib
  6. # : current_dir - 2
  7. PROJECT_ROOT = os.path.join(os.path.abspath(os.path.split(os.path.realpath(__file__))[0] + "/.."), '..')
  8. sys.path.insert(0, PROJECT_ROOT)
  9. from script.base import init_env
  10. init_env(interactive = True)
  11. from apps.web.ad.models import Advertisement
  12. ads = Advertisement.objects.all()
  13. for ad in ads:
  14. if ad.PIN == '1234':
  15. ad.PIN = '1234'
  16. ad.offlineFansNumber = 400
  17. ad.password = hashlib.md5('1234').hexdigest()
  18. ad.username = str(ad.adId)
  19. ad.save()
  20. print 'execute ok'