21 |
21 |
|
22 |
22 |
from django.core import signing
|
23 |
23 |
from django.core.exceptions import PermissionDenied, ValidationError
|
24 |
24 |
from django.db import transaction
|
25 |
25 |
from django.views.generic.base import ContextMixin
|
26 |
26 |
from django.views.generic import (FormView, UpdateView, CreateView, DeleteView, TemplateView,
|
27 |
27 |
DetailView, View)
|
28 |
28 |
from django.views.generic.detail import SingleObjectMixin
|
|
29 |
from django.views.generic.edit import FormMixin
|
29 |
30 |
from django.http import HttpResponse, Http404
|
30 |
31 |
from django.utils.encoding import force_text
|
31 |
32 |
from django.utils import six
|
32 |
33 |
from django.utils.translation import ugettext_lazy as _
|
33 |
34 |
from django.utils.timezone import now
|
34 |
35 |
from django.urls import reverse
|
35 |
36 |
from django.urls import reverse_lazy
|
36 |
37 |
from django.contrib.messages.views import SuccessMessageMixin
|
... | ... | |
48 |
49 |
from authentic2.forms.profile import modelform_factory
|
49 |
50 |
from authentic2.utils import redirect, batch_queryset
|
50 |
51 |
from authentic2.decorators import json as json_view
|
51 |
52 |
from authentic2 import hooks
|
52 |
53 |
|
53 |
54 |
from . import app_settings, utils, forms, widgets
|
54 |
55 |
|
55 |
56 |
|
56 |
|
# https://github.com/MongoEngine/django-mongoengine/blob/master/django_mongoengine/views/edit.py
|
57 |
|
import django.views.generic.edit
|
58 |
|
|
59 |
|
try:
|
60 |
|
FormMixin = django.views.generic.edit.FormMixinBase
|
61 |
|
except AttributeError:
|
62 |
|
# django >= 1.10
|
63 |
|
FormMixin = django.views.generic.edit.FormMixin
|
64 |
|
|
65 |
|
|
66 |
57 |
class MediaMixinBase(MediaDefiningClass, FormMixin):
|
67 |
58 |
pass
|
68 |
59 |
|
69 |
60 |
|
70 |
61 |
class MultipleOUMixin(object):
|
71 |
62 |
'''Tell templates if there are multiple OU for adaptation in breadcrumbs for example'''
|
72 |
63 |
def get_context_data(self, **kwargs):
|
73 |
64 |
kwargs['multiple_ou'] = utils.get_ou_count() > 1
|
74 |
|
-
|