forked from 0x2620/pandora
split documentsort into it's own manage.py command, does not get applied during install otherwise
This commit is contained in:
parent
c3a86df762
commit
7521467975
4 changed files with 29 additions and 3 deletions
|
@ -29,6 +29,7 @@ class Command(BaseCommand):
|
||||||
[manage_py, 'migrate', '--noinput'],
|
[manage_py, 'migrate', '--noinput'],
|
||||||
[manage_py, 'sqlfindindex'],
|
[manage_py, 'sqlfindindex'],
|
||||||
[manage_py, 'sync_itemsort'],
|
[manage_py, 'sync_itemsort'],
|
||||||
|
[manage_py, 'sync_documentsort'],
|
||||||
[manage_py, 'update_static'],
|
[manage_py, 'update_static'],
|
||||||
[manage_py, 'compile_pyc', '-p', os.path.dirname(manage_py)],
|
[manage_py, 'compile_pyc', '-p', os.path.dirname(manage_py)],
|
||||||
]:
|
]:
|
||||||
|
|
27
pandora/document/management/commands/sync_documentsort.py
Normal file
27
pandora/document/management/commands/sync_documentsort.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
from django.db import connection, transaction
|
||||||
|
from django.db.models import fields
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
|
settings.RELOAD_CONFIG = False
|
||||||
|
import app.monkey_patch
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
"""
|
||||||
|
sync document sort table with current settings in site.json
|
||||||
|
"""
|
||||||
|
help = 'alter table to match documentKeys in site.json.'
|
||||||
|
args = ''
|
||||||
|
|
||||||
|
def add_arguments(self, parser):
|
||||||
|
parser.add_argument('--debug', action='store_true', dest='debug',
|
||||||
|
default=False, help='print sql commans')
|
||||||
|
|
||||||
|
def handle(self, **options):
|
||||||
|
import document.sync_sort
|
||||||
|
document.sync_sort.update_tables(options['debug'])
|
|
@ -116,6 +116,3 @@ class Command(BaseCommand):
|
||||||
if options['debug']:
|
if options['debug']:
|
||||||
print(i)
|
print(i)
|
||||||
i.update_sort()
|
i.update_sort()
|
||||||
# and udpate doucments
|
|
||||||
import document.sync_sort
|
|
||||||
document.sync_sort.update_tables(options['debug'])
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ if __name__ == "__main__":
|
||||||
run('./manage.py', 'migrate', '--noinput')
|
run('./manage.py', 'migrate', '--noinput')
|
||||||
run('./manage.py', 'sqlfindindex')
|
run('./manage.py', 'sqlfindindex')
|
||||||
run('./manage.py', 'sync_itemsort')
|
run('./manage.py', 'sync_itemsort')
|
||||||
|
run('./manage.py', 'sync_documentsort')
|
||||||
reload_notice(base)
|
reload_notice(base)
|
||||||
elif len(sys.argv) == 2 and sys.argv[1] == 'static':
|
elif len(sys.argv) == 2 and sys.argv[1] == 'static':
|
||||||
os.chdir(join(base, 'pandora'))
|
os.chdir(join(base, 'pandora'))
|
||||||
|
|
Loading…
Reference in a new issue