Hi,

I guess the reason you wrote to this list about your unify command, is
because you don't mind contributing it to the django project.

So maybe you could show the code of this command, so people can
understand what improvements it can offer.

I am not sure I understood anything so far. Are you just pre-rendering
{% include %} tags, so the template engine doesn't have to do that in
runtime?


--

Pavlos Georgiadis


On 18/01/19 11:31, J. Pablo Martín Cobos wrote:
> I answer between lines
>
> El jue., 17 ene. 2019 a las 18:42, Maciek Olko (<maciej.o...@gmail.com
> <mailto:maciej.o...@gmail.com>>) escribió:
>
>     Did you try to measure the difference in time of rendering
>     standard and your way?
>
>
> Yes. I have several examples:
>
> App   Template        Num templates rendered before unify     Num templates
> rendered after unify  Time render template before unify (ms)  Time
> render template after unify (ms)      Improve
> Django admin  admin/index.html        3       1       75 - 110        71 - 79 
>         22%
> Django admin  admin/change_list.html  26      Command error   180-300
> Command error         
> Django admin  admin/change_form.html  16      Command error   350-400
> Command error         
> Django constance      admin/constance/change_list.html        7       1       
> 350-400
> 150-250       75%
> Django su     su/login.html   5       3       15- 20  10 - 12         54%
>
>
> My command currently does not work with several complex templates like
> admin/change_list.html or admin/change_form.html But we can improve
> it, currently it works with almost all.
>
> If there is a nice improve with views that render few templates...
> imagine with views with a lot of templates.
>
> I have measure these times with django-debug-toolbar-template-timings
>
> With this email only I want to know if you see it can be a important
> feature to add to Django framework... or it is a silly thing.
>
> Best,
>
>  
>
>     Regards,
>     Maciej
>
>     czw., 17.01.2019, 10:02 użytkownik J. Pablo Martín Cobos
>     <goi...@gmail.com <mailto:goi...@gmail.com>> napisał:
>
>         Hi,
>
>         From one year ago, I am using an own command for Django
>         templates that unify them. With an example it is easy to see.
>         If I am to render for example a template call news.html like it:
>
>         1. news.html
>
>             {% extends "base.html" %}
>
>             {% block title %}
>                 {% include "inc.news.title.html" %}
>             {% endblock %}
>
>             {% block content %}
>                 {% for news_item in news %}
>                     <h2>{{ news_item.title }}</h2>
>                     <p>{{ news_item.subtitle }}</p>
>                 {% endfor %}
>             {% endblock %}
>
>         2. base.html
>
>             <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>             <html xmlns="http://www.w3.org/1999/xhtml"; lang="{{
>         LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI
>         %}dir="rtl"{% endif %}>
>                 <head>
>                     <title>{% block title %}{% endblock %}</title>
>                 </head>
>                 <body>
>                     {% block content %}{% endblock %}
>                 </body>
>             </html>
>
>         3. inc.news.title.html
>             News
>
>         With this command I preproces every template of a settings
>         variable and I get something like this:
>
>         news.unify.html
>
>             <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
>         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
>             <html xmlns="http://www.w3.org/1999/xhtml"; lang="{{
>         LANGUAGE_CODE|default:"en-us" }}" {% if LANGUAGE_BIDI
>         %}dir="rtl"{% endif %}>
>                 <head>
>                     <title>News</title>
>                 </head>
>                 <body>
>                     {% for news_item in news %}
>                         <h2>{{ news_item.title }}</h2>
>                         <p>{{ news_item.subtitle }}</p>
>                     {% endfor %}
>                 </body>
>             </html>
>
>         So I have a two improves:
>
>          1. It is more fast. And in a real project a view can render
>             easyly 50 templates
>          2. I use news.html to develop and news.unify.html to
>             production. So I don't lose legilibility.
>
>
>         What do you think about "unify templates feature"? Do you know
>         if exists a similar public project in github/gitlab/bitbucket etc?
>
>
>         Best,
>
>         -- 
>         Pablo Martín Cobos
>         Computer engineer
>         Python/Django developer
>         652 53 37 36 <tel:652%2053%2037%2036>
>         goi...@gmail.com <mailto:goi...@gmail.com>
>         -- 
>         You received this message because you are subscribed to the
>         Google Groups "Django developers (Contributions to Django
>         itself)" group.
>         To unsubscribe from this group and stop receiving emails from
>         it, send an email to
>         django-developers+unsubscr...@googlegroups.com
>         <mailto:django-developers+unsubscr...@googlegroups.com>.
>         To post to this group, send email to
>         django-developers@googlegroups.com
>         <mailto:django-developers@googlegroups.com>.
>         Visit this group at
>         https://groups.google.com/group/django-developers.
>         To view this discussion on the web visit
>         
> https://groups.google.com/d/msgid/django-developers/CALNyWLGNcuK8DTnU9w9fyGFhFfT3dAz7vfj3B%2BnDHWTfneLNFw%40mail.gmail.com
>         
> <https://groups.google.com/d/msgid/django-developers/CALNyWLGNcuK8DTnU9w9fyGFhFfT3dAz7vfj3B%2BnDHWTfneLNFw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>         For more options, visit https://groups.google.com/d/optout.
>
>     -- 
>     You received this message because you are subscribed to the Google
>     Groups "Django developers (Contributions to Django itself)" group.
>     To unsubscribe from this group and stop receiving emails from it,
>     send an email to django-developers+unsubscr...@googlegroups.com
>     <mailto:django-developers+unsubscr...@googlegroups.com>.
>     To post to this group, send email to
>     django-developers@googlegroups.com
>     <mailto:django-developers@googlegroups.com>.
>     Visit this group at https://groups.google.com/group/django-developers.
>     To view this discussion on the web visit
>     
> https://groups.google.com/d/msgid/django-developers/CALYYG805GZFJL5b_9nortw8Sj%2Bkrx1p4xqki7C96Zd8vHeYsmw%40mail.gmail.com
>     
> <https://groups.google.com/d/msgid/django-developers/CALYYG805GZFJL5b_9nortw8Sj%2Bkrx1p4xqki7C96Zd8vHeYsmw%40mail.gmail.com?utm_medium=email&utm_source=footer>.
>     For more options, visit https://groups.google.com/d/optout.
>
>
>
> -- 
> Pablo Martín Cobos
> Computer engineer
> Python/Django developer
> 652 53 37 36 <tel:652%2053%2037%2036>
> goi...@gmail.com <mailto:goi...@gmail.com>
> -- 
> You received this message because you are subscribed to the Google
> Groups "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-developers+unsubscr...@googlegroups.com
> <mailto:django-developers+unsubscr...@googlegroups.com>.
> To post to this group, send email to
> django-developers@googlegroups.com
> <mailto:django-developers@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CALNyWLFfTS72VtH5kOALqDyCNS2q%3DDn5f7cuQEcepGcz-im6AQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-developers/CALNyWLFfTS72VtH5kOALqDyCNS2q%3DDn5f7cuQEcepGcz-im6AQ%40mail.gmail.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
--
Pavlos Georgiadis

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/7ae3e45a-f58f-e01e-0e7c-56b004598eb6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to