create dedicated tile for goto page (if required)
This commit is contained in:
parent
2946e979fa
commit
38625f6a65
|
@ -38,7 +38,7 @@ from django.utils.safestring import mark_safe
|
|||
|
||||
from combo.apps.dashboard.models import DashboardCell
|
||||
from combo.apps.maps.models import Map, MapLayer
|
||||
from combo.data.models import Page, ConfigJsonCell
|
||||
from combo.data.models import Page, CellBase, ConfigJsonCell
|
||||
from combo.public.views import render_cell
|
||||
from combo.utils import requests
|
||||
|
||||
|
@ -692,3 +692,18 @@ def json_script(value, element_id):
|
|||
'<script id="{}" type="application/json">{}</script>',
|
||||
element_id, mark_safe(json_str)
|
||||
)
|
||||
|
||||
@register.assignment_tag
|
||||
def get_goto_cell(page, request):
|
||||
try:
|
||||
cell = ConfigJsonCell.objects.get(id=request.GET['to'])
|
||||
except (ConfigJsonCell.DoesNotExist, KeyError):
|
||||
return None
|
||||
if cell.page.template_name != 'place':
|
||||
return cell
|
||||
# create an alternate version of cell
|
||||
cell.id = None
|
||||
cell.placeholder = '_auto_tile'
|
||||
cell.page = page
|
||||
cell.save()
|
||||
return cell
|
||||
|
|
Loading…
Reference in New Issue