Giter Club home page Giter Club logo

Comments (9)

dkopitsa avatar dkopitsa commented on May 25, 2024 1

It works for me. Thank you very much!

from django-render-block.

clokep avatar clokep commented on May 25, 2024

At first glance it looks like it should be, yes. I'll try to take a look at this soon!

from django-render-block.

dkopitsa avatar dkopitsa commented on May 25, 2024

I have same problem.

I have two templates.
'base.email' :

{% block subject %}Email subject{% endblock %}
{% block html %}
    <html>
     ..skip..  
    {% block html_content %}{%endblock %}
   ..skip..
    </html>
{% endblock %}

and 'test.email':

{% extends "base.email" %}
{% block html_content %}
<h1>Hello world</h1>
{% endblock %}

I expect that render_block_to_string('test.email', 'html') returns full html code with text 'hello world',
but I only get html without block html_content

from django-render-block.

clokep avatar clokep commented on May 25, 2024

I think what's happening is that we:

  • Check the sub-template for the black.
  • The black isn't found so we check the base template.
  • We find the block and render it using only data from the base template.

Clearly the last step here is wrong and that we need to be using the block from the sub-template here.

from django-render-block.

clokep avatar clokep commented on May 25, 2024

Thanks for the bug report, by the way! I was sure I had missed some cases in my test-cases. Clearly you found one!

from django-render-block.

clokep avatar clokep commented on May 25, 2024

I have this mostly fixed.

from django-render-block.

clokep avatar clokep commented on May 25, 2024

@aericson @dkopitsa Thanks for the reports! I just merged a PR (#8) which fixes this. There's a couple of minor clean-ups I want to do, but I should be able to do a release in the next few days. (Feel free to poke me if I don't!)

from django-render-block.

aericson avatar aericson commented on May 25, 2024

👏

from django-render-block.

clokep avatar clokep commented on May 25, 2024

Just pushed version 0.5 with these changes. Thanks for confirming it works!

from django-render-block.

Related Issues (13)

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.