Skip to content

Commit

Permalink
Add new views.nextjs_page API
Browse files Browse the repository at this point in the history
  • Loading branch information
danialkeimasi committed May 13, 2024
1 parent cccd8ed commit 9f15da1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions django_nextjs/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from typing import Dict, Union

from .render import render_nextjs_page


def nextjs_page(
*,
template_name: str = "",
context: Union[Dict, None] = None,
using: Union[str, None] = None,
allow_redirects: bool = False,
headers: Union[Dict, None] = None,
):
async def view(request, *args, **kwargs):
return await render_nextjs_page(
request=request,
template_name=template_name,
context=context,
using=using,
allow_redirects=allow_redirects,
headers=headers,
)

return view

0 comments on commit 9f15da1

Please sign in to comment.