Created
April 20, 2015 04:07
-
-
Save lucemia/0cadcf5f65306059f07b to your computer and use it in GitHub Desktop.
fix_creative.py
This file contains hidden or 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
| from console.models import * | |
| cs = Creative.objects.all() | |
| keys = [ | |
| 'css:.img_footer_body ul .img_footer_page img:width', | |
| 'css:.img_footer_body ul .img_footer_page img:height', | |
| 'css:.thumb:width', | |
| 'css:.thumb:height' | |
| ] | |
| for c in cs: | |
| for k in keys: | |
| m = c.settings.get(k) | |
| try: | |
| m = int(m) | |
| c.settings[k] = str(m) + 'px' | |
| #print 'fix px', c, k | |
| #c.save() | |
| except Exception as e: | |
| #print e | |
| pass | |
| if 'css:.item_img:width' in c.settings: | |
| c.settings['css:.thumb:width'] = c.settings['css:.item_img:width'] | |
| if 'css:.item_img:height' in c.settings: | |
| c.settings['css:.thumb:height'] = c.settings['css:.item_img:height'] | |
| if 'css:.item_img:overflow' in c.settings: | |
| c.settings['css:.item_img:overflow'] = 'hidden' | |
| print c | |
| c.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment