Private
Public Access
1
0

publishing sliders

This commit is contained in:
sanderroosendaal
2016-10-31 15:52:12 +01:00
parent be6333081e
commit 7fb67ff176
115 changed files with 0 additions and 275 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,76 +0,0 @@
# The following code is tested on Django 1.7
import django
import sys
import logging
from django.apps import apps
from django.db.migrations.recorder import MigrationRecorder
if django.get_version() > '1.7':
from django.core.serializers import sort_dependencies
else:
from django.core.management.commands.dumpdata import sort_dependencies
LOG_FORMAT = '%(asctime)s|%(levelname)s|%(message)s'
logging.basicConfig(stream=sys.stdout, level=logging.INFO, format=LOG_FORMAT)
logger = logging.getLogger(__name__)
def copy(model):
table_name = model._meta.db_table
logger.info('Start import %s into new_db' % table_name)
table_objects = model.objects.all()
for t in table_objects:
t.save(using='new_db')
logger.info('Successfuly imported %s into new_db' % table_name)
'''
Please note that the id for many to many objects might be diffrent from source table.
This is because id is not specified in the add method.
'''
def copy_m2m(model, m2m_field):
table_name = m2m_field.rel.through._meta.db_table
field_name = m2m_field.name
to_model = m2m_field.rel.to
pk_name = model._meta.pk.name
child_pk_name = to_model._meta.pk.name
logger.info('Start import %s into new_db' % table_name)
for o in model.objects.all():
pk_value = getattr(o, pk_name)
new_o = model.objects.using('new_db').get(**{pk_name: pk_value})
for child in getattr(o, field_name).all():
child_pk_value = getattr(child, child_pk_name)
new_child = to_model.objects.using('new_db').get(**{child_pk_name: child_pk_value})
getattr(new_o, field_name).add(new_child)
logger.info('Successfuly imported %s into new_db' % table_name)
def run():
logger.info('Start move data into new_db')
app_configs = apps.get_app_configs()
app_list = [(a, None) for a in app_configs]
models = sort_dependencies(app_list)
models_with_m2m = []
for m in models:
copy(m)
if m._meta.many_to_many:
models_with_m2m.append(m)
# Migration model needs to copy separately as it is not in the INSTALLED_APPS
copy(MigrationRecorder.Migration)
# re-create object in ManyToManyField
for m in models_with_m2m:
for field in m._meta.many_to_many:
# data for field that has specific through model should have been copied in earlier steps
if field.rel.through._meta.auto_created:
copy_m2m(m, field)
logger.info('Successfully moved data into new_db')

View File

@@ -1,189 +0,0 @@
alabaster==0.7.7
amqp==1.4.9
anaconda-client==1.4.0
anaconda-navigator==1.1.0
anyjson==0.3.3
argcomplete==1.0.0
astropy==1.1.2
Babel==2.2.0
backports-abc==0.4
backports.ssl-match-hostname==3.4.0.2
beautifulsoup4==4.4.1
billiard==3.3.0.23
bitarray==0.8.1
blaze==0.9.1
bokeh==0.11.1
boto==2.39.0
Bottleneck==1.0.0
cairocffi==0.7.2
cdecimal==2.3
celery==3.1.23
certifi==2016.2.28
cffi==1.5.2
chest==0.2.3
click==6.6
cloudpickle==0.1.1
clyent==1.2.1
colorama==0.3.7
comtypes==1.1.2
conda==4.0.5
conda-build==1.20.0
conda-env==2.4.5
conda-manager==0.3.1
configobj==5.0.6
cryptography==1.3
cycler==0.10.0
Cython==0.23.4
cytoolz==0.7.5
dask==0.8.1
datashape==0.5.1
decorator==4.0.9
dill==0.2.4
Django==1.9.5
django-braces==1.8.1
django-celery==3.1.17
django-cors-headers==1.1.0
django-durationfield==0.5.2
django-modelcluster==1.1
django-oauth-toolkit==0.10.0
django-rq==0.9.0
django-taggit==0.18.1
django-translation-manager==0.3.4
django-treebeard==4.0
djangorestframework==3.3.3
docopt==0.6.2
docutils==0.12
enum34==1.1.2
et-xmlfile==1.0.1
fastcache==1.0.2
filemagic==1.6
Flask==0.10.1
Flask-Cors==2.1.2
Flask-Login==0.3.2
Flask-OpenID==1.2.5
Flask-Uploads==0.2.0
flower==0.9.1
funcsigs==0.4
future==0.15.2
futures==3.0.3
gevent==1.1.0
greenlet==0.4.9
grin==1.2.1
gunicorn==19.4.5
h5py==2.5.0
HeapDict==1.0.0
html5lib==0.9999999
httplib2==0.9.2
idna==2.0
ipaddress==1.0.14
ipykernel==4.3.1
ipython==4.1.2
ipython-genutils==0.1.0
ipywidgets==4.1.1
itsdangerous==0.24
jdcal==1.2
jedi==0.9.0
Jinja2==2.8
jsonschema==2.4.0
jupyter==1.0.0
jupyter-client==4.2.2
jupyter-console==4.1.1
jupyter-core==4.1.0
kombu==3.0.35
libmagic==1.0
llvmlite==0.9.0
locket==0.2.0
lxml==3.6.0
MarkupSafe==0.23
matplotlib==1.5.1
mechanize==0.2.5
menuinst==1.3.2
mistune==0.7.2
mpld3==0.2
mpmath==0.19
multipledispatch==0.4.8
nbconvert==4.1.0
nbformat==4.0.1
networkx==1.11
nltk==3.2
nose==1.3.7
notebook==4.1.0
numba==0.24.0
numexpr==2.5
numpy==1.11.0
oauth2==1.9.0.post1
oauthlib==1.0.3
odo==0.4.2
openpyxl==2.3.2
pandas==0.18.0
partd==0.3.2
path.py==0.0.0
patsy==0.4.0
pep8==1.7.0
pickleshare==0.5
Pillow==3.1.1
ply==3.8
polib==1.0.7
psutil==4.1.0
py==1.4.31
pyasn1==0.1.9
pycosat==0.6.1
pycparser==2.14
pycrypto==2.6.1
pyflakes==1.1.0
Pygments==2.1.1
pymarc==3.1.1
pyOpenSSL==0.15.1
pyparsing==2.0.3
pypi-data==0.1.4
pypilist==0.1.0
pyreadline==2.1
pytest==2.8.5
python-dateutil==2.5.1
python-magic==0.4.11
python-openid==2.2.5
pytz==2016.4
pywin32==220
PyYAML==3.11
pyzmq==15.2.0
QtAwesome==0.3.2
qtconsole==4.2.0
QtPy==1.0
redis==2.10.5
requests==2.9.1
requests-oauthlib==0.6.1
rope==0.9.4
rowingdata==0.80.4
rowingphysics==0.2.4
rq==0.6.0
scikit-image==0.12.3
scikit-learn==0.17.1
scipy==0.17.0
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.10.0
snowballstemmer==1.2.1
sockjs-tornado==1.0.1
South==1.0.2
sphinx==1.3.5
sphinx-pypi-upload==0.2.1
sphinx-rtd-theme==0.1.9
spyder==2.3.8
SQLAlchemy==1.0.12
statsmodels==0.6.1
sympy==1.0
tables==3.2.2
toolz==0.7.4
tornado==4.2
tqdm==4.4.0
traitlets==4.2.1
unicodecsv==0.14.1
Unidecode==0.4.19
virtualenv==15.0.1
wagtail==1.4.3
Werkzeug==0.11.4
Willow==0.3
xlrd==0.9.4
XlsxWriter==0.8.4
xlwings==0.7.0
xlwt==1.0.0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More