Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Using a unicorn view as a view #179

Closed
Joetib opened this issue Apr 11, 2021 · 2 comments
Closed

Using a unicorn view as a view #179

Joetib opened this issue Apr 11, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Joetib
Copy link

Joetib commented Apr 11, 2021

I find myself writing duplicate views. A Django regular view that simply serves an html which does nothing but load a unicorn view and then the unicorn view itself.

I was wondering if it was possible to present the unicorn view directly to the user.

Also I was wondering if unicorn will have an equivalent of some client side routing strategy

@adamghill adamghill mentioned this issue Apr 11, 2021
@adamghill
Copy link
Owner

adamghill commented Apr 11, 2021

I just attached a draft PR with how I think rendering a component view directly might work.

Something like:

from example.unicorn.components.text_inputs import TextInputsView

urlpatterns = [
    path("direct-view", TextInputsView.as_view(), name="direct-view",),
]

How does that look to you?

I still need to figure out how the csrf token and javascript portion would get included on the page. I think that the component would extend/include a template with {% csrf_token %} and {% unicorn_scripts %}? Does that seem like a reasonable requirement?

@adamghill adamghill self-assigned this Apr 11, 2021
@adamghill adamghill added the enhancement New feature or request label Apr 11, 2021
@Joetib
Copy link
Author

Joetib commented Apr 11, 2021

Yeah extending seems great to me.

Repository owner locked and limited conversation to collaborators Aug 14, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants