Compare commits
3 commits
13fcb20796
...
1d6d53e282
| Author | SHA1 | Date | |
|---|---|---|---|
| 1d6d53e282 | |||
| cc56858377 | |||
| 6296be870b |
24 changed files with 80 additions and 31 deletions
|
|
@ -1,19 +1,22 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
from django.core.management.base import BaseCommand
|
from django.core.management.base import BaseCommand
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
|
|
||||||
import app.monkey_patch
|
import app.monkey_patch
|
||||||
|
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
from user.models import User
|
|
||||||
|
|
||||||
from ... import models
|
from ... import models
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
"""
|
"""
|
||||||
import annotations
|
import annotations
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import unicodedata
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models.signals import pre_delete
|
from django.db.models.signals import pre_delete
|
||||||
|
|
||||||
|
|
@ -20,6 +20,8 @@ from item.utils import sort_string, get_by_key
|
||||||
from . import managers
|
from . import managers
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
def get_super_matches(obj, model):
|
def get_super_matches(obj, model):
|
||||||
super_matches = []
|
super_matches = []
|
||||||
name_lower = obj.name.lower()
|
name_lower = obj.name.lower()
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import division, print_function, absolute_import
|
from __future__ import division, print_function, absolute_import
|
||||||
|
|
||||||
import ox
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
|
import ox
|
||||||
from celery.task import task
|
from celery.task import task
|
||||||
|
|
||||||
from .models import Annotation
|
from .models import Annotation
|
||||||
|
|
@ -14,7 +15,8 @@ from .models import Annotation
|
||||||
def add_annotations(data):
|
def add_annotations(data):
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
from entity.models import Entity
|
from entity.models import Entity
|
||||||
from user.models import User
|
User = get_user_model()
|
||||||
|
|
||||||
item = Item.objects.get(public_id=data['item'])
|
item = Item.objects.get(public_id=data['item'])
|
||||||
layer_id = data['layer']
|
layer_id = data['layer']
|
||||||
layer = list(filter(lambda l: l['id'] == layer_id, settings.CONFIG['layers']))
|
layer = list(filter(lambda l: l['id'] == layer_id, settings.CONFIG['layers']))
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ from glob import glob
|
||||||
|
|
||||||
from six.moves import _thread as thread
|
from six.moves import _thread as thread
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
import ox.jsonc
|
import ox.jsonc
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
|
@ -20,6 +20,7 @@ from ox.utils import json
|
||||||
from archive.extract import supported_formats
|
from archive.extract import supported_formats
|
||||||
from item.utils import get_by_id
|
from item.utils import get_by_id
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
_win = (sys.platform == "win32")
|
_win = (sys.platform == "win32")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,13 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import division, print_function, absolute_import
|
from __future__ import division, print_function, absolute_import
|
||||||
|
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth import get_user_model
|
||||||
|
from django.contrib.auth.models import Group
|
||||||
|
|
||||||
from django.core.validators import MaxLengthValidator
|
from django.core.validators import MaxLengthValidator
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
# load config from json
|
# load config from json
|
||||||
from . import config
|
from . import config
|
||||||
config.init()
|
config.init()
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ import time
|
||||||
|
|
||||||
from six import string_types, PY2
|
from six import string_types, PY2
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.signals import pre_delete
|
from django.db.models.signals import pre_delete
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
@ -28,6 +28,8 @@ from .chunk import save_chunk
|
||||||
from . import extract
|
from . import extract
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
if not PY2:
|
if not PY2:
|
||||||
unicode = str
|
unicode = str
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ from __future__ import division, print_function, absolute_import
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from oxdjango.fields import JSONField
|
from oxdjango.fields import JSONField
|
||||||
|
|
@ -14,6 +14,8 @@ import websocket
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
'''
|
'''
|
||||||
FIXME: remove this table more migrate to new ChangeLog
|
FIXME: remove this table more migrate to new ChangeLog
|
||||||
'''
|
'''
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ class MetaClip(object):
|
||||||
|
|
||||||
self.findvalue = '\n'.join(list(filter(None, [a.findvalue for a in anns])))
|
self.findvalue = '\n'.join(list(filter(None, [a.findvalue for a in anns])))
|
||||||
for l in [k['id'] for k in settings.CONFIG['layers']]:
|
for l in [k['id'] for k in settings.CONFIG['layers']]:
|
||||||
setattr(self, l, l in anns_by_layer and len(anns_by_layer[l]))
|
setattr(self, l, l in anns_by_layer and bool(len(anns_by_layer[l])))
|
||||||
models.Model.save(self, *args, **kwargs)
|
models.Model.save(self, *args, **kwargs)
|
||||||
|
|
||||||
clip_keys = ('id', 'in', 'out', 'position', 'created', 'modified',
|
clip_keys = ('id', 'in', 'out', 'position', 'created', 'modified',
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ from oxdjango.managers import get_operator
|
||||||
|
|
||||||
from documentcollection.models import Collection
|
from documentcollection.models import Collection
|
||||||
from item import utils
|
from item import utils
|
||||||
|
from user.models import Group
|
||||||
|
|
||||||
|
|
||||||
keymap = {
|
keymap = {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from six import PY2, string_types
|
||||||
from six.moves.urllib.parse import quote, unquote
|
from six.moves.urllib.parse import quote, unquote
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import Q, Sum, Max
|
from django.db.models import Q, Sum, Max
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth import get_user_model
|
||||||
from django.db.models.signals import pre_delete
|
from django.db.models.signals import pre_delete
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
@ -26,10 +26,13 @@ from item.models import Item
|
||||||
from annotation.models import Annotation
|
from annotation.models import Annotation
|
||||||
from archive.extract import resize_image
|
from archive.extract import resize_image
|
||||||
from archive.chunk import save_chunk
|
from archive.chunk import save_chunk
|
||||||
|
from user.models import Group
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
if not PY2:
|
if not PY2:
|
||||||
unicode = str
|
unicode = str
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from glob import glob
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth import get_user_model
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from oxdjango.fields import JSONField
|
from oxdjango.fields import JSONField
|
||||||
|
|
@ -17,9 +17,12 @@ import ox
|
||||||
|
|
||||||
from archive import extract
|
from archive import extract
|
||||||
from user.utils import update_groups
|
from user.utils import update_groups
|
||||||
|
from user.models import Group
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
def get_path(f, x):
|
def get_path(f, x):
|
||||||
return f.path(x)
|
return f.path(x)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@ import ox
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from oxdjango.fields import JSONField
|
from oxdjango.fields import JSONField
|
||||||
|
|
||||||
|
|
@ -24,9 +25,13 @@ import clip.models
|
||||||
|
|
||||||
from archive import extract
|
from archive import extract
|
||||||
from user.utils import update_groups
|
from user.utils import update_groups
|
||||||
|
from user.models import Group
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
def get_path(f, x): return f.path(x)
|
def get_path(f, x): return f.path(x)
|
||||||
def get_icon_path(f, x): return get_path(f, 'icon.jpg')
|
def get_icon_path(f, x): return get_path(f, 'icon.jpg')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,8 @@ from six import string_types
|
||||||
from six.moves.urllib.parse import quote, unquote
|
from six.moves.urllib.parse import quote, unquote
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from django.db.models.signals import pre_delete, post_init
|
from django.db.models.signals import pre_delete, post_init
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
@ -25,6 +26,7 @@ from document.models import Document
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Entity(models.Model):
|
class Entity(models.Model):
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
from __future__ import division, print_function, absolute_import
|
from __future__ import division, print_function, absolute_import
|
||||||
|
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
|
|
@ -16,6 +17,7 @@ from title.models import get_title_sort
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Event(models.Model):
|
class Event(models.Model):
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ from django.conf import settings
|
||||||
|
|
||||||
from archive.models import Volume
|
from archive.models import Volume
|
||||||
from itemlist.models import List
|
from itemlist.models import List
|
||||||
from django.contrib.auth.models import Group
|
from user.models import Group
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
from oxdjango.query import QuerySet
|
from oxdjango.query import QuerySet
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ from six.moves.urllib.parse import quote
|
||||||
from django.db import models, transaction, connection
|
from django.db import models, transaction, connection
|
||||||
from django.db.models import Q, Sum, Max
|
from django.db.models import Q, Sum, Max
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from django.db.models.signals import pre_delete
|
from django.db.models.signals import pre_delete
|
||||||
from django.utils import datetime_safe
|
from django.utils import datetime_safe
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
@ -41,8 +42,10 @@ from person.models import get_name_sort
|
||||||
from sequence.tasks import get_sequences
|
from sequence.tasks import get_sequences
|
||||||
from title.models import get_title_sort
|
from title.models import get_title_sort
|
||||||
from user.utils import update_groups
|
from user.utils import update_groups
|
||||||
|
from user.models import Group
|
||||||
import archive.models
|
import archive.models
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
if not PY2:
|
if not PY2:
|
||||||
unicode = str
|
unicode = str
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ from glob import glob
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth import get_user_model
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from oxdjango.fields import JSONField
|
from oxdjango.fields import JSONField
|
||||||
|
|
@ -17,9 +17,11 @@ import ox
|
||||||
|
|
||||||
from archive import extract
|
from archive import extract
|
||||||
from user.utils import update_groups
|
from user.utils import update_groups
|
||||||
|
from user.models import Group
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
def get_path(f, x): return f.path(x)
|
def get_path(f, x): return f.path(x)
|
||||||
def get_icon_path(f, x): return get_path(f, 'icon.jpg')
|
def get_icon_path(f, x): return get_path(f, 'icon.jpg')
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,16 @@
|
||||||
from __future__ import division, print_function, absolute_import
|
from __future__ import division, print_function, absolute_import
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Log(models.Model):
|
class Log(models.Model):
|
||||||
created = models.DateTimeField(auto_now_add=True, db_index=True)
|
created = models.DateTimeField(auto_now_add=True, db_index=True)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
from __future__ import division, print_function, absolute_import
|
from __future__ import division, print_function, absolute_import
|
||||||
|
|
||||||
from django.db import models, transaction
|
from django.db import models, transaction
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
import ox
|
import ox
|
||||||
from oxdjango import fields
|
from oxdjango import fields
|
||||||
|
|
@ -12,6 +13,7 @@ from item.models import Item
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class Place(models.Model):
|
class Place(models.Model):
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from time import time
|
||||||
|
|
||||||
from celery.backends import default_backend
|
from celery.backends import default_backend
|
||||||
from celery.utils import get_full_cls_name
|
from celery.utils import get_full_cls_name
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
@ -15,6 +15,7 @@ import celery.task.control
|
||||||
import kombu.five
|
import kombu.five
|
||||||
import ox
|
import ox
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
def get_tasks(username):
|
def get_tasks(username):
|
||||||
from item.models import Item
|
from item.models import Item
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ from glob import glob
|
||||||
from six.moves.urllib.parse import quote
|
from six.moves.urllib.parse import quote
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db.models.signals import pre_delete
|
from django.db.models.signals import pre_delete
|
||||||
from django.utils.encoding import python_2_unicode_compatible
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
@ -21,6 +21,7 @@ from archive.chunk import save_chunk
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
def get_path(i, x): return i.path(x)
|
def get_path(i, x): return i.path(x)
|
||||||
def get_icon_path(i, x): return get_path(i, 'icon.jpg')
|
def get_icon_path(i, x): return get_path(i, 'icon.jpg')
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,8 @@ from __future__ import division, print_function, absolute_import
|
||||||
import copy
|
import copy
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth.models import Group
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
@ -14,15 +15,11 @@ from oxdjango.fields import JSONField
|
||||||
import ox
|
import ox
|
||||||
from ox.utils import json
|
from ox.utils import json
|
||||||
|
|
||||||
from itemlist.models import List, Position
|
|
||||||
import text
|
|
||||||
import edit
|
|
||||||
import documentcollection.models
|
|
||||||
|
|
||||||
from . import managers
|
from . import managers
|
||||||
from . import tasks
|
from . import tasks
|
||||||
from .utils import get_ip, get_location
|
from .utils import get_ip, get_location
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class SessionData(models.Model):
|
class SessionData(models.Model):
|
||||||
|
|
@ -231,6 +228,11 @@ def profile_post_save(sender, instance, **kwargs):
|
||||||
models.signals.post_save.connect(profile_post_save, sender=UserProfile)
|
models.signals.post_save.connect(profile_post_save, sender=UserProfile)
|
||||||
|
|
||||||
def get_ui(user_ui, user=None):
|
def get_ui(user_ui, user=None):
|
||||||
|
from itemlist.models import List, Position
|
||||||
|
import documentcollection.models
|
||||||
|
import edit.models
|
||||||
|
import text.models
|
||||||
|
|
||||||
ui = {}
|
ui = {}
|
||||||
config = copy.deepcopy(settings.CONFIG)
|
config = copy.deepcopy(settings.CONFIG)
|
||||||
ui.update(config['user']['ui'])
|
ui.update(config['user']['ui'])
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
from django.contrib.gis.geoip2 import GeoIP2
|
from django.contrib.gis.geoip2 import GeoIP2
|
||||||
from django.contrib.auth.models import Group
|
|
||||||
|
|
||||||
import ox
|
import ox
|
||||||
|
|
||||||
|
|
@ -73,6 +72,7 @@ def rename_user(u, new):
|
||||||
u.save()
|
u.save()
|
||||||
|
|
||||||
def update_groups(model, groups):
|
def update_groups(model, groups):
|
||||||
|
from .models import Group
|
||||||
if isinstance(groups, list):
|
if isinstance(groups, list):
|
||||||
groups = list(filter(lambda g: g.strip(), groups))
|
groups = list(filter(lambda g: g.strip(), groups))
|
||||||
groups = [ox.escape_html(g) for g in groups]
|
groups = [ox.escape_html(g) for g in groups]
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ from django.core.mail import send_mail, BadHeaderError, EmailMessage
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
from django.contrib.auth.models import User, Group
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.sessions.models import Session
|
from django.contrib.sessions.models import Session
|
||||||
|
|
||||||
from oxdjango.shortcuts import render_to_json_response, json_response, get_object_or_404_json
|
from oxdjango.shortcuts import render_to_json_response, json_response, get_object_or_404_json
|
||||||
|
|
@ -25,11 +25,13 @@ from oxdjango.api import actions
|
||||||
from item.models import Access, Item
|
from item.models import Access, Item
|
||||||
from item import utils
|
from item import utils
|
||||||
from changelog.models import add_changelog
|
from changelog.models import add_changelog
|
||||||
|
from user.models import Group
|
||||||
|
|
||||||
from . import models
|
from . import models
|
||||||
from .decorators import capability_required_json
|
from .decorators import capability_required_json
|
||||||
from .utils import rename_user
|
from .utils import rename_user
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
def get_user_or_404(data):
|
def get_user_or_404(data):
|
||||||
if 'id' in data:
|
if 'id' in data:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue