use get_user_model

This commit is contained in:
j 2018-07-29 21:12:56 +01:00
parent 13fcb20796
commit 6296be870b
20 changed files with 71 additions and 23 deletions

View file

@ -1,19 +1,22 @@
# -*- coding: utf-8 -*-
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.db import transaction
from django.conf import settings
import ox
import app.monkey_patch
from item.models import Item
from user.models import User
from ... import models
User = get_user_model()
class Command(BaseCommand):
"""
import annotations

View file

@ -7,7 +7,7 @@ import unicodedata
from django.utils.encoding import python_2_unicode_compatible
from django.db import models, transaction
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.db.models.signals import pre_delete
@ -20,6 +20,8 @@ from item.utils import sort_string, get_by_key
from . import managers
from . import utils
User = get_user_model()
def get_super_matches(obj, model):
super_matches = []
name_lower = obj.name.lower()

View file

@ -1,10 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
import ox
from django.conf import settings
from django.contrib.auth import get_user_model
from django.db import transaction
import ox
from celery.task import task
from .models import Annotation
@ -14,7 +15,8 @@ from .models import Annotation
def add_annotations(data):
from item.models import Item
from entity.models import Entity
from user.models import User
User = get_user_model()
item = Item.objects.get(public_id=data['item'])
layer_id = data['layer']
layer = list(filter(lambda l: l['id'] == layer_id, settings.CONFIG['layers']))

View file

@ -12,7 +12,7 @@ from glob import glob
from six.moves import _thread as thread
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth import get_user_model
import ox.jsonc
from ox.utils import json
@ -20,6 +20,7 @@ from ox.utils import json
from archive.extract import supported_formats
from item.utils import get_by_id
User = get_user_model()
_win = (sys.platform == "win32")

View file

@ -1,9 +1,13 @@
# -*- coding: utf-8 -*-
from __future__ import division, print_function, absolute_import
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.core.validators import MaxLengthValidator
User = get_user_model()
# load config from json
from . import config
config.init()

View file

@ -9,7 +9,7 @@ import time
from six import string_types, PY2
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.models.signals import pre_delete
from django.utils.encoding import python_2_unicode_compatible
@ -28,6 +28,8 @@ from .chunk import save_chunk
from . import extract
from . import managers
User = get_user_model()
if not PY2:
unicode = str

View file

@ -3,7 +3,7 @@ from __future__ import division, print_function, absolute_import
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.utils.encoding import python_2_unicode_compatible
from oxdjango.fields import JSONField
@ -14,6 +14,8 @@ import websocket
from . import managers
User = get_user_model()
'''
FIXME: remove this table more migrate to new ChangeLog
'''

View file

@ -10,7 +10,8 @@ from six import PY2, string_types
from six.moves.urllib.parse import quote, unquote
from django.db import models, transaction
from django.db.models import Q, Sum, Max
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.models.signals import pre_delete
from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
@ -30,6 +31,8 @@ from archive.chunk import save_chunk
from . import managers
from . import utils
User = get_user_model()
if not PY2:
unicode = str

View file

@ -8,7 +8,8 @@ from glob import glob
from django.db import models
from django.db.models import Max
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.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from oxdjango.fields import JSONField
@ -20,6 +21,8 @@ from user.utils import update_groups
from . import managers
User = get_user_model()
def get_path(f, x):
return f.path(x)

View file

@ -13,7 +13,9 @@ import ox
from django.conf import settings
from django.db import models, transaction
from django.db.models import Max
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.utils.encoding import python_2_unicode_compatible
from oxdjango.fields import JSONField
@ -27,6 +29,9 @@ from user.utils import update_groups
from . import managers
User = get_user_model()
def get_path(f, x): return f.path(x)
def get_icon_path(f, x): return get_path(f, 'icon.jpg')

View file

@ -10,7 +10,8 @@ from six import string_types
from six.moves.urllib.parse import quote, unquote
from django.db import models, transaction
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.conf import settings
from django.utils.encoding import python_2_unicode_compatible
@ -25,6 +26,7 @@ from document.models import Document
from . import managers
User = get_user_model()
@python_2_unicode_compatible
class Entity(models.Model):

View file

@ -2,7 +2,8 @@
from __future__ import division, print_function, absolute_import
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
import ox
@ -16,6 +17,7 @@ from title.models import get_title_sort
from . import managers
User = get_user_model()
@python_2_unicode_compatible
class Event(models.Model):

View file

@ -17,7 +17,9 @@ from six.moves.urllib.parse import quote
from django.db import models, transaction, connection
from django.db.models import Q, Sum, Max
from django.conf import settings
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.models.signals import pre_delete
from django.utils import datetime_safe
from django.utils.encoding import python_2_unicode_compatible
@ -43,6 +45,7 @@ from title.models import get_title_sort
from user.utils import update_groups
import archive.models
User = get_user_model()
if not PY2:
unicode = str

View file

@ -8,7 +8,8 @@ from glob import glob
from django.db import models
from django.db.models import Max
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.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from oxdjango.fields import JSONField
@ -20,6 +21,7 @@ from user.utils import update_groups
from . import managers
User = get_user_model()
def get_path(f, x): return f.path(x)
def get_icon_path(f, x): return get_path(f, 'icon.jpg')

View file

@ -2,12 +2,16 @@
from __future__ import division, print_function, absolute_import
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
import ox
from . import managers
User = get_user_model()
@python_2_unicode_compatible
class Log(models.Model):
created = models.DateTimeField(auto_now_add=True, db_index=True)

View file

@ -2,7 +2,8 @@
from __future__ import division, print_function, absolute_import
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
import ox
from oxdjango import fields
@ -12,6 +13,7 @@ from item.models import Item
from . import managers
User = get_user_model()
@python_2_unicode_compatible
class Place(models.Model):

View file

@ -6,7 +6,7 @@ from time import time
from celery.backends import default_backend
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.db import models
from django.db.models import Q
@ -15,6 +15,7 @@ import celery.task.control
import kombu.five
import ox
User = get_user_model()
def get_tasks(username):
from item.models import Item

View file

@ -9,7 +9,7 @@ from glob import glob
from six.moves.urllib.parse import quote
from django.db import models
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.db.models.signals import pre_delete
from django.utils.encoding import python_2_unicode_compatible
@ -21,6 +21,7 @@ from archive.chunk import save_chunk
from . import managers
User = get_user_model()
def get_path(i, x): return i.path(x)
def get_icon_path(i, x): return get_path(i, 'icon.jpg')

View file

@ -4,7 +4,8 @@ from __future__ import division, print_function, absolute_import
import copy
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.models import Max
from django.conf import settings
@ -23,6 +24,7 @@ from . import managers
from . import tasks
from .utils import get_ip, get_location
User = get_user_model()
@python_2_unicode_compatible
class SessionData(models.Model):

View file

@ -13,7 +13,8 @@ from django.core.mail import send_mail, BadHeaderError, EmailMessage
from django.shortcuts import redirect
from django.db import transaction
from django.db.models import Max
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.contrib.sessions.models import Session
from oxdjango.shortcuts import render_to_json_response, json_response, get_object_or_404_json
@ -30,6 +31,7 @@ from . import models
from .decorators import capability_required_json
from .utils import rename_user
User = get_user_model()
def get_user_or_404(data):
if 'id' in data: