The New Way to Build with AI! Introducing ReUI — the developer platform for agentic UI with shadcn/ui
Browse ReUI Pro

How to customize the templates and create custom views


Hi i have a problem, i need to customize a view by passing something specific on the context, but the problem that i have is that if i recall my custom templates inside the default _templates/pages folder they are not recognized as templates (?)
but if i copy the template inside a local "templates" folder inside my app, it say: 'TemplateSyntaxError at /school
Invalid template name in 'extends' tag: ''. Got this from the 'layout' variable. '
How can i resolve this issue? I also tryed copying all the content of _templates folder inside my "templates" folder but it gives the same error.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (1)

 
Deleted comment

if you want to customize the layout in your views.py file using the KTTheme class, you can add the following code:

def your_view(request):
# Your view logic here

# Update the context to set the custom layout
context.update({
"layout": KTTheme.setLayout("default.html", context),
})

# Return the rendered template with the updated context
return render(request, "your_template.html", context)

Here's what this code does:

Import the KTTheme class from your themes module. Replace 'your_app_name' with the actual name of your app.

In your view function (your_view in this example), add the logic for your view.

Update the context dictionary with the layout using KTTheme.setLayout('default.html', context). This sets the layout for your template to 'default.html'. You can replace 'default.html' with the name of the layout you want to use.

Finally, render your template ('your_template.html' in this example) with the updated context.


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
buy metronic keenthemes mega bundle

ReUI

Open-source React components, blocks and templates built on shadcn/ui and Tailwind CSS by Keenthemes.