Merge pull request #422 from Gluejar/facets_instance_var
rewrite some classes in facets.py to use instance variablespull/1/head
commit
187e48e820
|
@ -4,12 +4,10 @@ from regluit.core import cc
|
||||||
|
|
||||||
class BaseFacet(object):
|
class BaseFacet(object):
|
||||||
facet_name = 'all'
|
facet_name = 'all'
|
||||||
outer_facet = None
|
|
||||||
model = get_model('core', 'Work')
|
|
||||||
|
|
||||||
def __init__(self, outer_facet):
|
def __init__(self, outer_facet):
|
||||||
if outer_facet:
|
self.outer_facet = outer_facet if outer_facet else None
|
||||||
self.outer_facet = outer_facet
|
self.model = get_model('core', 'Work')
|
||||||
|
|
||||||
def _get_query_set(self):
|
def _get_query_set(self):
|
||||||
if self.outer_facet:
|
if self.outer_facet:
|
||||||
|
@ -81,8 +79,12 @@ class NamedFacet(BaseFacet):
|
||||||
self.set_name()
|
self.set_name()
|
||||||
|
|
||||||
class FormatFacetGroup(FacetGroup):
|
class FormatFacetGroup(FacetGroup):
|
||||||
title = 'Format'
|
|
||||||
facets = ['pdf', 'epub', 'mobi']
|
def __init__(self):
|
||||||
|
super(FacetGroup,self).__init__()
|
||||||
|
self.title = 'Format'
|
||||||
|
self.facets = ['pdf', 'epub', 'mobi']
|
||||||
|
|
||||||
|
|
||||||
def get_facet_class(self, facet_name):
|
def get_facet_class(self, facet_name):
|
||||||
class FormatFacet(NamedFacet):
|
class FormatFacet(NamedFacet):
|
||||||
|
@ -96,9 +98,13 @@ class FormatFacetGroup(FacetGroup):
|
||||||
|
|
||||||
|
|
||||||
class LicenseFacetGroup(FacetGroup):
|
class LicenseFacetGroup(FacetGroup):
|
||||||
title = 'License'
|
|
||||||
licenses = cc.LICENSE_LIST_ALL
|
def __init__(self):
|
||||||
facets = cc.FACET_LIST
|
super(FacetGroup,self).__init__()
|
||||||
|
self.title = 'License'
|
||||||
|
self.licenses = cc.LICENSE_LIST_ALL
|
||||||
|
self.facets = cc.FACET_LIST
|
||||||
|
|
||||||
|
|
||||||
def get_facet_class(self, facet_name):
|
def get_facet_class(self, facet_name):
|
||||||
class LicenseFacet(NamedFacet):
|
class LicenseFacet(NamedFacet):
|
||||||
|
|
Loading…
Reference in New Issue