Remove the data filters feature.
Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -114,6 +114,7 @@
|
||||
revoke permissions for the selected role.
|
||||
- Only show the new document link if the user has access to create documents of
|
||||
at least one document type. GitLab Issue #302. Thanks to kg @kgraves.
|
||||
- Remove the data filters feature.
|
||||
|
||||
2.7.3 (2017-09-11)
|
||||
==================
|
||||
|
||||
@@ -371,6 +371,7 @@ Other changes worth mentioning
|
||||
- Add support for groups ACLs.
|
||||
- Sort permission namespaces and permissions in the role permission views.
|
||||
- Invert the columns in the ACL detail view.
|
||||
- Remove the data filters feature.
|
||||
|
||||
Removals
|
||||
--------
|
||||
|
||||
@@ -23,9 +23,8 @@ from .handlers import (
|
||||
from .links import (
|
||||
link_about, link_check_version, link_code, link_current_user_details,
|
||||
link_current_user_edit, link_current_user_locale_profile_edit,
|
||||
link_documentation, link_filters, link_forum, link_license,
|
||||
link_object_error_list_clear, link_packages_licenses, link_setup,
|
||||
link_support, link_tools
|
||||
link_documentation, link_forum, link_license, link_object_error_list_clear,
|
||||
link_packages_licenses, link_setup, link_support, link_tools
|
||||
)
|
||||
|
||||
from .literals import DELETE_STALE_UPLOADS_INTERVAL
|
||||
@@ -142,9 +141,6 @@ class CommonApp(MayanAppConfig):
|
||||
'common:object_error_list',
|
||||
)
|
||||
)
|
||||
menu_tools.bind_links(
|
||||
links=(link_filters,)
|
||||
)
|
||||
|
||||
post_save.connect(
|
||||
user_locale_profile_create,
|
||||
|
||||
@@ -120,50 +120,6 @@ class ErrorLogNamespace(object):
|
||||
return ErrorLogEntry.objects.filter(namespace=self.name)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Filter(object):
|
||||
_registry = {}
|
||||
|
||||
@classmethod
|
||||
def get(cls, slug):
|
||||
return cls._registry[slug]
|
||||
|
||||
@classmethod
|
||||
def all(cls):
|
||||
return cls._registry
|
||||
|
||||
def __init__(self, label, slug, filter_kwargs, model, object_permission=None, hide_links=False):
|
||||
self.label = label
|
||||
self.slug = slug
|
||||
self.filter_kwargs = filter_kwargs
|
||||
self.model = model
|
||||
self.object_permission = object_permission
|
||||
self.hide_links = hide_links
|
||||
|
||||
self.__class__._registry[self.slug] = self
|
||||
|
||||
def __str__(self):
|
||||
return force_text(self.label)
|
||||
|
||||
def get_queryset(self, user):
|
||||
AccessControlList = apps.get_model(
|
||||
app_label='acls', model_name='AccessControlList'
|
||||
)
|
||||
|
||||
queryset = self.model.objects.all()
|
||||
for kwargs in self.filter_kwargs:
|
||||
queryset = queryset.filter(**kwargs)
|
||||
|
||||
queryset = queryset.distinct()
|
||||
|
||||
if self.object_permission:
|
||||
return AccessControlList.objects.filter_by_access(
|
||||
self.object_permission, user, queryset=queryset
|
||||
)
|
||||
else:
|
||||
return queryset
|
||||
|
||||
|
||||
class MissingItem(object):
|
||||
_registry = []
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ from django.db import models
|
||||
from django.utils.module_loading import import_string
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from .classes import Filter, Package
|
||||
from .classes import Package
|
||||
from .models import UserLocaleProfile
|
||||
from .utils import return_attrib
|
||||
from .widgets import (
|
||||
@@ -139,14 +139,6 @@ class FileDisplayForm(forms.Form):
|
||||
fd.close()
|
||||
|
||||
|
||||
class FilterForm(forms.Form):
|
||||
filter_slug = forms.ChoiceField(label=_('Filter'))
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FilterForm, self).__init__(*args, **kwargs)
|
||||
self.fields['filter_slug'].choices = Filter.all().items()
|
||||
|
||||
|
||||
class LicenseForm(FileDisplayForm):
|
||||
DIRECTORY = ()
|
||||
FILENAME = 'LICENSE'
|
||||
|
||||
@@ -71,10 +71,6 @@ link_object_error_list_with_icon = Link(
|
||||
permissions=(permission_error_log_view,), text=_('Errors'),
|
||||
view='common:error_list',
|
||||
)
|
||||
link_filters = Link(
|
||||
icon='fa fa-filter', text=_('Data filters'),
|
||||
view='common:filter_selection'
|
||||
)
|
||||
link_forum = Link(
|
||||
icon='fa fa-life-ring', tags='new_window', text=_('Forum'),
|
||||
url='https://groups.google.com/forum/#!forum/mayan-edms'
|
||||
|
||||
@@ -7,10 +7,9 @@ from .api_views import APIContentTypeList
|
||||
from .views import (
|
||||
AboutView, CheckVersionView, CurrentUserDetailsView, CurrentUserEditView,
|
||||
CurrentUserLocaleProfileDetailsView, CurrentUserLocaleProfileEditView,
|
||||
FaviconRedirectView, FilterResultListView, FilterSelectView, HomeView,
|
||||
LicenseView, ObjectErrorLogEntryListClearView, ObjectErrorLogEntryListView,
|
||||
PackagesLicensesView, RootView, SetupListView, ToolsListView,
|
||||
multi_object_action_view
|
||||
FaviconRedirectView, HomeView, LicenseView, ObjectErrorLogEntryListClearView,
|
||||
ObjectErrorLogEntryListView, PackagesLicensesView, RootView, SetupListView,
|
||||
ToolsListView, multi_object_action_view
|
||||
)
|
||||
|
||||
urlpatterns = [
|
||||
@@ -48,14 +47,6 @@ urlpatterns = [
|
||||
r'^user/locale/edit/$', CurrentUserLocaleProfileEditView.as_view(),
|
||||
name='current_user_locale_profile_edit'
|
||||
),
|
||||
url(
|
||||
r'^filter/select/$', FilterSelectView.as_view(),
|
||||
name='filter_selection'
|
||||
),
|
||||
url(
|
||||
r'^filter/(?P<slug>[\w-]+)/results/$', FilterResultListView.as_view(),
|
||||
name='filter_results'
|
||||
),
|
||||
url(
|
||||
r'^object/(?P<app_label>[-\w]+)/(?P<model>[-\w]+)/(?P<object_id>\d+)/errors/$',
|
||||
ObjectErrorLogEntryListView.as_view(), name='object_error_list'
|
||||
|
||||
@@ -16,10 +16,9 @@ from django.views.generic import RedirectView, TemplateView
|
||||
|
||||
from acls.models import AccessControlList
|
||||
|
||||
from .classes import Filter
|
||||
from .exceptions import NotLatestVersion
|
||||
from .forms import (
|
||||
FilterForm, LicenseForm, LocaleProfileForm, LocaleProfileForm_view,
|
||||
LicenseForm, LocaleProfileForm, LocaleProfileForm_view,
|
||||
PackagesLicensesForm, UserForm, UserForm_view
|
||||
)
|
||||
from .generics import ( # NOQA
|
||||
@@ -146,45 +145,6 @@ class FaviconRedirectView(RedirectView):
|
||||
return static('appearance/images/favicon.ico')
|
||||
|
||||
|
||||
class FilterSelectView(SimpleView):
|
||||
form_class = FilterForm
|
||||
template_name = 'appearance/generic_form.html'
|
||||
|
||||
def get_form(self):
|
||||
return FilterForm()
|
||||
|
||||
def get_extra_context(self):
|
||||
return {
|
||||
'form': self.get_form(),
|
||||
'title': _('Filter selection')
|
||||
}
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
return HttpResponseRedirect(
|
||||
reverse(
|
||||
'common:filter_results',
|
||||
args=(request.POST.get('filter_slug'),)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class FilterResultListView(SingleObjectListView):
|
||||
def get_extra_context(self):
|
||||
return {
|
||||
'hide_links': self.get_filter().hide_links,
|
||||
'title': _('Results for filter: %s') % self.get_filter()
|
||||
}
|
||||
|
||||
def get_filter(self):
|
||||
try:
|
||||
return Filter.get(self.kwargs['slug'])
|
||||
except KeyError:
|
||||
raise Http404(ugettext('Filter not found'))
|
||||
|
||||
def get_object_list(self):
|
||||
return self.get_filter().get_queryset(user=self.request.user)
|
||||
|
||||
|
||||
class HomeView(TemplateView):
|
||||
template_name = 'appearance/home.html'
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ from common import (
|
||||
MayanAppConfig, menu_facet, menu_multi_item, menu_object, menu_secondary,
|
||||
menu_setup, menu_sidebar
|
||||
)
|
||||
from common.classes import ModelAttribute, Filter
|
||||
from common.classes import ModelAttribute
|
||||
from common.widgets import two_state_template
|
||||
from documents.search import document_page_search, document_search
|
||||
from documents.signals import post_document_type_change
|
||||
@@ -79,40 +79,6 @@ class MetadataApp(MayanAppConfig):
|
||||
'metadata_value_of', DocumentMetadataHelper.constructor
|
||||
)
|
||||
|
||||
Filter(
|
||||
label=_('Documents missing required metadata'),
|
||||
slug='documents-no-required-metadata',
|
||||
filter_kwargs=[
|
||||
{
|
||||
'document_type__metadata__required': True,
|
||||
},
|
||||
{
|
||||
'metadata__value__isnull': True
|
||||
},
|
||||
{
|
||||
'is_stub': False
|
||||
}
|
||||
], model=Document, object_permission=permission_document_view,
|
||||
hide_links=True
|
||||
)
|
||||
|
||||
Filter(
|
||||
label=_('Documents missing optional metadata'),
|
||||
slug='documents-no-optional-metadata',
|
||||
filter_kwargs=[
|
||||
{
|
||||
'document_type__metadata__required': False,
|
||||
},
|
||||
{
|
||||
'metadata__value__isnull': True
|
||||
},
|
||||
{
|
||||
'is_stub': False
|
||||
}
|
||||
], model=Document, object_permission=permission_document_view,
|
||||
hide_links=True
|
||||
)
|
||||
|
||||
ModelAttribute(
|
||||
Document, 'metadata', type_name='related',
|
||||
description=_(
|
||||
|
||||
Reference in New Issue
Block a user