diff --git a/mayan/apps/folders/apps.py b/mayan/apps/folders/apps.py index 70e6b9fca1..b27a581a71 100644 --- a/mayan/apps/folders/apps.py +++ b/mayan/apps/folders/apps.py @@ -10,7 +10,7 @@ from common import ( menu_sidebar, menu_multi_item ) from documents.models import Document -from navigation import CombinedSource, SourceColumn +from navigation import SourceColumn from rest_api.classes import APIEndPoint from .links import ( diff --git a/mayan/apps/folders/models.py b/mayan/apps/folders/models.py index bd5ef7341e..8f22c5afdb 100644 --- a/mayan/apps/folders/models.py +++ b/mayan/apps/folders/models.py @@ -23,7 +23,7 @@ class Folder(models.Model): auto_now_add=True, verbose_name=_('Datetime created') ) documents = models.ManyToManyField( - Document, related_name='folders', verbose_name=_('Documents') + Document, verbose_name=_('Documents') ) def __str__(self): @@ -49,3 +49,10 @@ class Folder(models.Model): unique_together = ('label', 'user') verbose_name = _('Folder') verbose_name_plural = _('Folders') + + +class DocumentFolder(Folder): + class Meta: + proxy = True + verbose_name = _('Document folder') + verbose_name_plural = _('Document folders') diff --git a/mayan/apps/navigation/__init__.py b/mayan/apps/navigation/__init__.py index c16b8c3864..696e28cd24 100644 --- a/mayan/apps/navigation/__init__.py +++ b/mayan/apps/navigation/__init__.py @@ -1 +1 @@ -from .classes import CombinedSource, Link, Menu, SourceColumn # NOQA +from .classes import Link, Menu, SourceColumn # NOQA diff --git a/mayan/apps/navigation/classes.py b/mayan/apps/navigation/classes.py index 095f0cef82..bafbaae915 100644 --- a/mayan/apps/navigation/classes.py +++ b/mayan/apps/navigation/classes.py @@ -96,7 +96,7 @@ class Menu(object): for bound_source, links in self.bound_links.iteritems(): try: - if inspect.isclass(bound_source) and type(resolved_navigation_object) == bound_source or source == CombinedSource(obj=resolved_navigation_object.__class__, view=current_view): + if inspect.isclass(bound_source) and type(resolved_navigation_object) == bound_source: for link in links: resolved_link = link.resolve( context=context, @@ -300,22 +300,3 @@ class SourceColumn(object): result = self.func(context=context) return result - - -class CombinedSource(object): - """ - Class that binds a link to a combination of an object and a view. - This is used to show links relating to a specific object type but only - in certain views. - Used by the PageDocument class to show rotatio and zoom link only on - certain views - """ - def __init__(self, obj, view): - self.obj = obj - self.view = view - - def __hash__(self): - return hash((self.obj, self.view)) - - def __eq__(self, other): - return hash(self) == hash(other) diff --git a/mayan/apps/tags/apps.py b/mayan/apps/tags/apps.py index 3f46edca2c..118c21e1f9 100644 --- a/mayan/apps/tags/apps.py +++ b/mayan/apps/tags/apps.py @@ -11,7 +11,7 @@ from common import ( ) from documents.models import Document from documents.search import document_search -from navigation import CombinedSource, SourceColumn +from navigation import SourceColumn from rest_api.classes import APIEndPoint from .links import (