Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b05dd31ff0 | ||
|
|
16a26afdce |
@@ -6,6 +6,8 @@ Overview:
|
|||||||
- [advanced example](#advanced-example) touches on the potentials of the plugin.
|
- [advanced example](#advanced-example) touches on the potentials of the plugin.
|
||||||
- [Misc](#misc) shows other use-cases.
|
- [Misc](#misc) shows other use-cases.
|
||||||
|
|
||||||
|
After reading this tutorial, have a look at other plugins that use `lektor-groupby`:
|
||||||
|
- [lektor-inlinetags](https://github.com/relikd/lektor-inlinetags-plugin)
|
||||||
|
|
||||||
|
|
||||||
## About
|
## About
|
||||||
|
|||||||
@@ -74,8 +74,10 @@ class GroupByModelReader:
|
|||||||
'''
|
'''
|
||||||
assert isinstance(record, Record)
|
assert isinstance(record, Record)
|
||||||
for r_key, subs in self._models.get(record.datamodel.id, {}).items():
|
for r_key, subs in self._models.get(record.datamodel.id, {}).items():
|
||||||
|
field = record[r_key]
|
||||||
|
if not field:
|
||||||
|
continue
|
||||||
if subs == '*': # either normal field or flow type (all blocks)
|
if subs == '*': # either normal field or flow type (all blocks)
|
||||||
field = record[r_key]
|
|
||||||
if flatten and isinstance(field, Flow):
|
if flatten and isinstance(field, Flow):
|
||||||
for i, flow in enumerate(field.blocks):
|
for i, flow in enumerate(field.blocks):
|
||||||
flowtype = flow['_flowblock']
|
flowtype = flow['_flowblock']
|
||||||
@@ -86,7 +88,7 @@ class GroupByModelReader:
|
|||||||
else:
|
else:
|
||||||
yield FieldKeyPath(r_key), field
|
yield FieldKeyPath(r_key), field
|
||||||
else: # always flow type (only some blocks)
|
else: # always flow type (only some blocks)
|
||||||
for i, flow in enumerate(record[r_key].blocks):
|
for i, flow in enumerate(field.blocks):
|
||||||
flowtype = flow['_flowblock']
|
flowtype = flow['_flowblock']
|
||||||
for f_key in self._flows.get(flowtype, []):
|
for f_key in self._flows.get(flowtype, []):
|
||||||
yield FieldKeyPath(r_key, i, f_key), flow[f_key]
|
yield FieldKeyPath(r_key, i, f_key), flow[f_key]
|
||||||
|
|||||||
3
setup.py
3
setup.py
@@ -13,7 +13,7 @@ setup(
|
|||||||
},
|
},
|
||||||
author='relikd',
|
author='relikd',
|
||||||
url='https://github.com/relikd/lektor-groupby-plugin',
|
url='https://github.com/relikd/lektor-groupby-plugin',
|
||||||
version='0.9.4',
|
version='0.9.5',
|
||||||
description='Cluster arbitrary records with field attribute keyword.',
|
description='Cluster arbitrary records with field attribute keyword.',
|
||||||
long_description=longdesc,
|
long_description=longdesc,
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
@@ -27,7 +27,6 @@ setup(
|
|||||||
'cluster',
|
'cluster',
|
||||||
],
|
],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
'Development Status :: 5 - Production/Stable',
|
|
||||||
'Environment :: Web Environment',
|
'Environment :: Web Environment',
|
||||||
'Environment :: Plugins',
|
'Environment :: Plugins',
|
||||||
'Framework :: Lektor',
|
'Framework :: Lektor',
|
||||||
|
|||||||
Reference in New Issue
Block a user