django-unicorn
django-unicorn copied to clipboard
Combining ```unicorn:view``` and ```unicorn:poll``` features gives error ```The 'control' component appears to have multiple root elements.```
I want to combine unicorn:view
and unicorn:poll
features in one Django template. I have this working but this gives the following warning:
The 'control' component appears to have multiple root elements.
My current templates/unicorn/control.html
is as follows:
...
% block content %}
<div unicorn:view unicorn:poll="get_updates">
...
And my components/interface.py
:
...
class InterfaceView(UnicornView):
def __init__(self, *args, **kwargs):
super().__init__(**kwargs)
self.name = kwargs.get("name")
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(InterfaceView, self).dispatch(*args, **kwargs)
def get_updates(self):
print('Updating page with poll')
self.current_time = now()
return PollUpdate(timing=1000, disable=False, method="get_updates")
...
I tried different combinations of unicorn:view
and unicorn:poll
but they fail completely or give the same warning. I cannot find any source that tells how to combine different Unicorn features.
Thanks for the error report! @mihrab34 is going to take a look at this issue and see if there is a straight-forward solution.