new documents section

This commit is contained in:
j 2016-10-05 00:00:03 +02:00
commit e1f35b1ec8
74 changed files with 6737 additions and 631 deletions

View file

@ -34,11 +34,13 @@ class Command(BaseCommand):
if settings.DB_GIN_TRGM:
import entity.models
import document.models
for table, column in (
(models.ItemFind._meta.db_table, 'value'), # Item Find
(models.Clip._meta.db_table, 'findvalue'), # Clip Find
(models.Annotation._meta.db_table, 'findvalue'), # Annotation Find
(entity.models.Find._meta.db_table, 'value'), # Entity Find
(document.models.Find._meta.db_table, 'value'), # Document Find
):
cursor = connection.cursor()
indexes = connection.introspection.get_indexes(cursor, table)

View file

@ -52,7 +52,7 @@ class Command(BaseCommand):
changes.append(sql)
rebuild = True
elif f.__class__.__name__ != db_types[name]:
sql = 'ALTER TABLE "%s" DROP COLUMN "%s"' % (table_name, name )
sql = 'ALTER TABLE "%s" DROP COLUMN "%s"' % (table_name, name)
changes.append(sql)
sql = 'ALTER TABLE "%s" ADD COLUMN "%s" %s' % (table_name, name, col_type)
changes.append(sql)
@ -116,3 +116,6 @@ class Command(BaseCommand):
if options['debug']:
print(i)
i.update_sort()
# and udpate doucments
import document.sync_sort
document.sync_sort.update_tables(options['debug'])

View file

@ -24,6 +24,7 @@ from django.utils import datetime_safe
import ox
from oxdjango import fields
from oxdjango.sortmodel import get_sort_field
import ox.web.imdb
import ox.image
@ -1741,27 +1742,9 @@ for key in filter(lambda k: k.get('sort', False) or k['type'] in ('integer', 'ti
sort_type = key.get('sortType', key['type'])
if isinstance(sort_type, list):
sort_type = sort_type[0]
model = {
'char': (models.CharField, dict(null=True, max_length=1000, db_index=True)),
'year': (models.CharField, dict(null=True, max_length=4, db_index=True)),
'integer': (models.BigIntegerField, dict(null=True, blank=True, db_index=True)),
'float': (models.FloatField, dict(null=True, blank=True, db_index=True)),
'date': (models.DateTimeField, dict(null=True, blank=True, db_index=True))
}[{
'layer': 'char',
'string': 'char',
'title': 'char',
'person': 'char',
'year': 'year',
'words': 'integer',
'length': 'integer',
'date': 'date',
'hue': 'float',
'time': 'integer',
'enum': 'integer',
}.get(sort_type, sort_type)]
field = get_sort_field(sort_type)
if name not in attrs:
attrs[name] = model[0](**model[1])
attrs[name] = field[0](**field[1])
ItemSort = type('ItemSort', (models.Model,), attrs)
ItemSort.fields = [f.name for f in ItemSort._meta.fields]

View file

@ -326,7 +326,7 @@ def autocomplete(request, data):
returns {
items: [string, ...] // list of matching strings
}
see: autocompleteEntities
see: autocompleteDocuments, autocompleteEntities
'''
if 'range' not in data:
data['range'] = [0, 10]