Remove CombinedSource class now that is no longer needed.

This commit is contained in:
Roberto Rosario
2015-08-24 02:27:44 -04:00
parent 6d2eed5148
commit 4ff19c6f95
5 changed files with 12 additions and 24 deletions

View File

@@ -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 (

View File

@@ -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')

View File

@@ -1 +1 @@
from .classes import CombinedSource, Link, Menu, SourceColumn # NOQA
from .classes import Link, Menu, SourceColumn # NOQA

View File

@@ -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)

View File

@@ -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 (