Instead of inserting the path of the apps into the Python app, the apps are now referenced by their full import path. This app name claves with external or native Python libraries. Example: Mayan statistics app vs. Python new statistics library. Every app reference is now prepended with 'mayan.apps'. Existing config.yml files need to be updated manually. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
34 lines
1.0 KiB
Python
34 lines
1.0 KiB
Python
from __future__ import absolute_import, unicode_literals
|
|
|
|
import logging
|
|
|
|
from django import forms
|
|
from django.utils.translation import ugettext_lazy as _
|
|
|
|
from mayan.apps.acls.models import AccessControlList
|
|
|
|
from .models import Cabinet
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class CabinetListForm(forms.Form):
|
|
def __init__(self, *args, **kwargs):
|
|
help_text = kwargs.pop('help_text', None)
|
|
permission = kwargs.pop('permission', None)
|
|
queryset = kwargs.pop('queryset', Cabinet.objects.all())
|
|
user = kwargs.pop('user', None)
|
|
|
|
logger.debug('user: %s', user)
|
|
super(CabinetListForm, self).__init__(*args, **kwargs)
|
|
|
|
queryset = AccessControlList.objects.filter_by_access(
|
|
permission=permission, user=user, queryset=queryset
|
|
)
|
|
|
|
self.fields['cabinets'] = forms.ModelMultipleChoiceField(
|
|
label=_('Cabinets'), help_text=help_text,
|
|
queryset=queryset, required=False,
|
|
widget=forms.SelectMultiple(attrs={'class': 'select2'})
|
|
)
|