import Group from user.models
This commit is contained in:
parent
6296be870b
commit
cc56858377
11 changed files with 15 additions and 14 deletions
|
@ -1,8 +1,8 @@
|
||||||
# -*- 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 Group
|
|
||||||
from django.contrib.auth import get_user_model
|
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
|
||||||
|
|
||||||
|
|
|
@ -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,6 @@ 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 Group
|
|
||||||
from django.contrib.auth import get_user_model
|
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
|
||||||
|
@ -27,6 +26,7 @@ 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
|
||||||
|
|
|
@ -8,7 +8,6 @@ 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 Group
|
|
||||||
from django.contrib.auth import get_user_model
|
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
|
||||||
|
@ -18,6 +17,7 @@ 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
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ 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 Group
|
|
||||||
from django.contrib.auth import get_user_model
|
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
|
||||||
|
@ -26,6 +25,7 @@ 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
|
||||||
|
|
||||||
|
|
|
@ -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,6 @@ 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 Group
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from django.db.models.signals import pre_delete
|
from django.db.models.signals import pre_delete
|
||||||
|
@ -43,6 +42,7 @@ 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()
|
User = get_user_model()
|
||||||
|
|
|
@ -8,7 +8,6 @@ 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 Group
|
|
||||||
from django.contrib.auth import get_user_model
|
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
|
||||||
|
@ -18,6 +17,7 @@ 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
|
||||||
|
|
||||||
|
|
|
@ -15,11 +15,6 @@ 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
|
||||||
|
@ -233,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,6 @@ 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 Group
|
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.sessions.models import Session
|
from django.contrib.sessions.models import Session
|
||||||
|
|
||||||
|
@ -26,6 +25,7 @@ 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
|
||||||
|
|
Loading…
Reference in a new issue