Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7706187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:03:35+00:00 2026-06-01T00:03:35+00:00

I am writing a custom tag to create dynamic css and other html formating

  • 0

I am writing a custom tag to create dynamic css and other html formating around container html blocks. Basically, the idea is I want some the boilerplate HTML to be nested around the “meat” of the html blocks. For example, let’s say I have a table, I then want to nest some divs (or possibly other things) around that. These divs are not always the same, but generally the same.

What I want is for the closing tag, as an example, {% endtag %} to also do something.

The beginning of the tag seems easy enough and can be done using inclusion.

To demonstrate my idea above, here is some HTML without the tag:

<div class=someclass>
    <table class=someclass id=someid>
        stuff here
    </table>
</div>

Instead, using the tag, it would look like this:

{% customtag arg %}
    <table class=someclass id=someid>
        stuff here
    </table>
{% endcustomtag %}

In the demonstration above customtag and endcustom tag each render the appropriate portions of the div.

In short:

Is it possible to use {% endXXX %}, or some other mechanism, to render HTML at the end of the block?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:03:36+00:00Added an answer on June 1, 2026 at 12:03 am

    You can!

    https://docs.djangoproject.com/en/dev/howto/custom-template-tags/#parsing-until-another-block-tag

    Have a look at a tag we’ve created, using the end tag:

    https://github.com/pythonheads/inc/blob/master/src/inc/templatetags/inc.py#L97

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a custom template tag 'firstnotnone', similar to the 'firstof' template tag of
I have gone through the (painful) process of writing a custom template tag for
I am writing custom code to create a blog. I need the archives page
I'm experimenting around with writing custom WinForms components and I wrote a couple of
I would like to write a custom JSP tag whose output includes other JSP
I'm writing my own custom template tag for Django for a purpose I keep
I am using NSPasteboardWriting protocol for writing custom object on NSPasteboard. How to create
When it comes to writing custom MySQL database-driven PHP session management for a VERY
When writing a custom server, what are the best practices or techniques to determine
while writing a custom attribute in C# i was wondering if there are any

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.