- generate an empty migration
- move the migration from
old_app
tonew_app
- edit the migration file to change all instances of
old_app
tonew_app
- add a forward migration to rename the table from
something
tosomething_else
- add a backward migration to do the opposite
- move models.py from
old_app
tonew_app
- apply the migration
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
crush() { | |
for f in *; | |
do | |
mv "$f" `echo $f | tr ' ' '_'` | |
done | |
for f in *.png | |
do | |
echo "$f" | |
pngcrush -brute "$f"{,.} && du -b "$f"{,.} |
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
from optparse import make_option | |
from django.core.management.base import BaseCommand, CommandError | |
from django.contrib.sites.models import Site | |
from django.db import transaction | |
from cms.models import Page | |
class Command(BaseCommand): |
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
> cmsplugin_filer_folder:0003_move_view_option_to_style | |
Error in migration: cmsplugin_filer_folder:0003_move_view_option_to_style | |
Traceback (most recent call last): | |
File "manage.py", line 10, in <module> | |
execute_from_command_line(sys.argv) | |
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line | |
utility.execute() | |
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute | |
self.fetch_command(subcommand).run_from_argv(self.argv) | |
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv |
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
00:50:04.391 2015-03-06 06:50:04.020323+00:00 app web.1 - - Traceback (most recent call last): | |
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 168, in __call__ | |
self.load_middleware() | |
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 46, in load_middleware | |
mw_instance = mw_class() | |
File "/app/.heroku/python/lib/python2.7/site-packages/django/middleware/locale.py", line 23, in __init__ | |
for url_pattern in get_resolver(None).url_patterns: | |
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/urlresolvers.py", line 372, in url_patterns | |
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) | |
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/urlresolvers.py", line 366, in urlconf_module |
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
from selenium import webdriver | |
def select_from_chosen(driver, id, value): | |
chosen = driver.find_element_by_id(id + '_chzn') | |
results = chosen.find_elements_by_css_selector(".chzn-results li") | |
found = False | |
for result in results: | |
if result.text == value: |
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
* { | |
font-size: 12pt; | |
font-family: monospace; | |
font-weight: normal; | |
font-style: normal; | |
text-decoration: none; | |
color: black; | |
cursor: default; | |
} |
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
(function( $ ) { | |
$.fn.simulateDragDrop = function(options) { | |
return this.each(function() { | |
new $.simulateDragDrop(this, options); | |
}); | |
}; | |
$.simulateDragDrop = function(elem, options) { | |
this.options = options; | |
this.simulateEvent(elem, options); | |
}; |
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
def icheck(self, selector, retry=True): | |
""" | |
Helper for iCheck radio inputs. N.B. We are using iCheck 2.0.x RC | |
Example: | |
self.icheck("#id-element") | |
:param selector: The id of the icheck target. | |
:type selector: str | |
:return: None |
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
# Written by Senko Rasic <senko.rasic@goodcode.io> | |
# Released into Public Domain. Use it as you like. | |
from django.db import models | |
class SingletonModel(models.Model): | |
"""Singleton Django Model | |
Ensures there's always only one entry in the database, and can fix the |
OlderNewer