0001-general-remove-blurps-20914.patch
README | ||
---|---|---|
81 | 81 |
documentation of django-mellon. |
82 | 82 | |
83 | 83 | |
84 |
Blurps (from cmsplugin-blurp module) can be used to define additional cell |
|
85 |
types, the CMS_PLUGIN_BLURP_RENDERERS variable is used to hold them, details |
|
86 |
can be found in the cmsplugin-blurp documentation. |
|
87 | ||
88 | 84 |
In addition to common attributes Combo supports a 'private' attribute, that can |
89 | 85 |
be used to exclude the given blurp from selectable cells. The blurp itself can |
90 | 86 |
still be referenced manually in a template file. This is useful to avoid |
combo/apps/wcs/models.py | ||
---|---|---|
370 | 370 |
try: |
371 | 371 |
context['forms'] = list(context['forms'][self.wcs_site]['data']) |
372 | 372 |
except (KeyError, TypeError) as e: |
373 |
# an error occured in the blurp
|
|
373 |
# an error occured when getting the data
|
|
374 | 374 |
context['forms'] = [] |
375 | 375 | |
376 | 376 |
# default sort is alphabetical, it's always done as this will serve as |
combo/data/models.py | ||
---|---|---|
45 | 45 |
from django.test.client import RequestFactory |
46 | 46 | |
47 | 47 |
from .fields import RichTextField |
48 |
import cmsplugin_blurp.utils |
|
49 | 48 | |
50 | 49 |
from jsonfield import JSONField |
51 | 50 | |
... | ... | |
595 | 594 |
def render(self, context): |
596 | 595 |
return '' |
597 | 596 | |
598 |
@register_cell_class |
|
599 |
class BlurpCell(CellBase): |
|
600 |
blurp_key = models.CharField(max_length=50) |
|
601 | ||
602 |
@classmethod |
|
603 |
def get_cell_types(cls): |
|
604 |
try: |
|
605 |
blurp_renderers = settings.CMS_PLUGIN_BLURP_RENDERERS |
|
606 |
except AttributeError: |
|
607 |
return [] |
|
608 |
l = [] |
|
609 |
for blurp_key, blurp_value in blurp_renderers.items(): |
|
610 |
if blurp_value.get('private'): |
|
611 |
continue |
|
612 |
l.append({ |
|
613 |
'name': blurp_value.get('name'), |
|
614 |
'cell_type_str': cls.get_cell_type_str(), |
|
615 |
'group': _('Extra'), |
|
616 |
'variant': blurp_key, |
|
617 |
}) |
|
618 |
l.sort(lambda x, y: cmp(x.get('name'), y.get('name'))) |
|
619 |
return l |
|
620 | ||
621 |
def get_label(self): |
|
622 |
return settings.CMS_PLUGIN_BLURP_RENDERERS[self.blurp_key]['name'] |
|
623 | ||
624 |
def set_variant(self, variant): |
|
625 |
self.blurp_key = variant |
|
626 | ||
627 |
def render(self, context): |
|
628 |
if settings.CMS_PLUGIN_BLURP_RENDERERS[self.blurp_key].get('ajax') and not context.get('synchronous'): |
|
629 |
raise NothingInCacheException() |
|
630 |
renderer = cmsplugin_blurp.utils.resolve_renderer(self.blurp_key) |
|
631 |
template = renderer.render_template() |
|
632 |
context = renderer.render(context) |
|
633 |
return template.render(context) |
|
634 | ||
635 |
def get_default_form_class(self): |
|
636 |
return None |
|
637 | ||
638 | 597 | |
639 | 598 |
@register_cell_class |
640 | 599 |
class MenuCell(CellBase): |
combo/settings.py | ||
---|---|---|
58 | 58 |
'ckeditor', |
59 | 59 |
'gadjo', |
60 | 60 |
'sorl.thumbnail', |
61 |
'cmsplugin_blurp', |
|
62 | 61 |
'combo.data', |
63 | 62 |
'combo.profile', |
64 | 63 |
'combo.manager', |
debian/control | ||
---|---|---|
14 | 14 |
python-gadjo, |
15 | 15 |
python-requests, |
16 | 16 |
python-feedparser, |
17 |
python-django-cmsplugin-blurp, |
|
18 | 17 |
python-xstatic-chartnew-js, |
19 | 18 |
python-xstatic-josefinsans, |
20 | 19 |
python-xstatic-leaflet, |
jenkins.sh | ||
---|---|---|
16 | 16 |
pip install --upgrade -r requirements.txt |
17 | 17 |
pip install --upgrade pytest pytest-django pytest-cov WebTest django-webtest 'setuptools<34' |
18 | 18 |
pip install --upgrade 'django>=1.8, <1.9' |
19 |
pip install --no-deps --upgrade 'git+http://repos.entrouvert.org/cmsplugin-blurp.git/#egg=django-cmsplugin-blurp' # use blurp from git/master for now |
|
20 | 19 |
pip install --upgrade XStatic-ChartNew.js |
21 | 20 |
pip install --upgrade mock |
22 | 21 |
requirements.txt | ||
---|---|---|
1 | 1 |
Django>=1.8, <1.9 |
2 | 2 |
django-ckeditor<4.5.3 |
3 | 3 |
gadjo |
4 |
django-cmsplugin-blurp |
|
5 | 4 |
feedparser |
6 | 5 |
django-jsonfield |
7 | 6 |
requests |
setup.py | ||
---|---|---|
106 | 106 |
install_requires=['django>=1.8, <1.9', |
107 | 107 |
'django-ckeditor<4.5.3', |
108 | 108 |
'gadjo', |
109 |
'django-cmsplugin-blurp', |
|
110 | 109 |
'feedparser', |
111 | 110 |
'django-jsonfield', |
112 | 111 |
'requests', |
113 |
- |