Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combining unicorn:view and unicorn:poll features gives error The 'control' component appears to have multiple root elements. #668

Open
wallem89 opened this issue Mar 7, 2024 · 1 comment
Labels
djangonauts Djangonaut Space

Comments

@wallem89
Copy link

wallem89 commented Mar 7, 2024

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.

@adamghill adamghill assigned adamghill and unassigned adamghill Jul 26, 2024
@adamghill adamghill added the djangonauts Djangonaut Space label Jul 26, 2024
@adamghill
Copy link
Owner

Thanks for the error report! @mihrab34 is going to take a look at this issue and see if there is a straight-forward solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
djangonauts Djangonaut Space
Projects
None yet
Development

No branches or pull requests

2 participants