Git Product home page Git Product logo

Comments (3)

rochacbruno avatar rochacbruno commented on July 29, 2024

The idea is to work with themes, but with fallback to defaut templates in /templates folder. I will take a look on this , if needed I will change the way templates are being loaded.

Any help or suggestion is appreciated.

Tks

from quokka.

rochacbruno avatar rochacbruno commented on July 29, 2024

I changed the way quokka_themes loads the templates, now the behavior is:

  1. Always try to find the template inside themes/theme_name/template_path
    if not found, then:
  2. Try to load the template from app quokka/templates/template_path
    if not found then:
  3. Try to load the template from blueprint/template_folder/template_path (default flask behavior)
    if not found then:
  4. raise TemplateNotFound exception.

Also I changed the way render_template works. Now you can pass only one template_path:
return render_template("template_path/template.html")

Or you can pass a list of templates to try:
return render_template(["path1.html", "path2.html"])

Also in default content views it will add automatically the templates "content/**object_class_name_**detail.html" and "content/**object_class_name_**list.html" as the high priority templates.

So in example for quokka-commerce: ['content/commerce_product_detail.html', ....]

The object_class_name is modulename_modelname

In that way if the module needs to use a customized template it can do by the above method or creating a custom view for the module and registering a specific url.

OBS: All the text above need to go to the wiki.

from quokka.

rochacbruno avatar rochacbruno commented on July 29, 2024

Template loading order to include in wiki

1 content/
2 contentlongslug.html
3
4 appname/channellongslug__modelname_suffix.html
5 *_recursiveuntilroot_modelname_suffix.html
6 appname/channellongslug_suffix.html
7 *_recursiveuntilroot_suffix.html
8 appname/modelname_suffix.html
9 appname/suffix.html
10
11 channellongslug_modelname_suffix.html
12 *_recursiveuntilroot_modelname_suffix.html
13 channellongslug_suffix.html
14 *_recursiveuntilroot_suffix.html
15
16 modelname_suffix.html

Try the above in /themes/ and also in /templates/

at last try to load.

18 suffix.html

from quokka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.