Django forms useless div tag - django

I am getting one problem while using django forms. Actually When I am using RadioSelect widget it is giving unnecessary div tags. Means each radio button is separated with individual div tag. And I don't want that. Please help Image of Div tags for each label
How can I get those label and input tag i.e Radio Buttons in single div tag not these many
index.html
forms.py

Related

Trix rendering html tags such as div and br tags in Django

I am using Trix as a rich text editor in Django, however i run into a problem, when going to save the data,
If i type, Hey trix check, it will return trix check backk
and it also adds br tags as well, if you want to check it can be seen on
www.brogrow.in
Can anyone help on it?
For login you can use -
Username - new &
password - Nov#2020
Try to add the safe filter in your template that display the content with the div and br tags. It should not display the HTML content of your blog posts.

Can we enter html code in a field in models in django?

I am making a small static website in which I have a template in which I tend to show the privacy policy terms of usage etc. I currently don't have any matter for it and tend to add it in future after deploying the site on server. I wanted to know that if I can in future add the matter on that page through a model i.e I create a model with two fields privacy policy , terms and in and pass it to the template as context in views.py . But I have a concern that the fields will have several headings which I will have to display in bold , so is there any way that I can pass html tags in model field and when I render it in my template as {{privacy}} the part I want in bold or any other style comes as that style.
So is there any way that I can pass html tags in model field and when I render it in my template as {{privacy}} the part I want in bold or any other style comes as that style.
Yes. You only need to tell the Django template engine not to escape the characters (for example translate < to <). You can do this with the |safe template tag [Django-doc]:
{{ privacy|safe }}

OrchardCMS Replacement Tokens for Query Results displaying HTML tags instead rendering them

I am having problems understanding the token system for the output of query / projections.
If I leave the property as is it displays the text content with HTML formatting intact.
But I need to wrap it with a tag, the html tags get displayed as text.
Rewrite Results -> Rewrite output
<div class="collapse" id="toggle_{Content.Id}">
{Content.Fields.CaseStudy.ClientChallenge} </div>
I am trying to create a collapsible text area, I already have a button that hides/unhides the content.
Why is it displaying as text instead of rendering the tags properly.
I think this is because I don't know how replacement tokens work.
Another example problem is up one level on the edit Layout, I want to set the item class to work-item {Category}, Category being the name/title of a property, which I am using for grouping.
Right above the projection: I want to include some html that lists all the Categorys in a ul i.e. data-filter=".experiential" I have tried things like: work-item {Category} and work-item {Content.Fields.CaseStudy.Category}. Category is a "term" (?) from a taxonomy.
I feel like I am failing to understand how it all works.
Submitted as a bug https://github.com/OrchardCMS/Orchard/issues/7355
Will edit and post if it is fixed. In case anoyong else comes across this issue.

Sitecore: Hide data template field from page editor

I have 2 data template fields "title" and "id", used for the HTML page title and the id attribute in the body tag respectively. When the page is viewed using Page Editor, Sitecore attempts to render editor controls on these items and because they are outside of the main form tag, controls don't get rendered correctly. I don't need these to be editable in the Page Editor.
What's the best approach/solution to handle fields like these?
Is hiding these 2 template fields from the Page Editor a solution?
If so, how do you hide the fields from the Page Editor and still have it available on the Content editor (so we can still edit it within the Content editor)?
In Page Editor, all you should need to do is render their values without a FieldRenderer. e.g, bind the field values to a standard .NET control. Or use a scriptlet -- <%=Sitecore.Context.Item["Title"]%>

TinyMCE Custom Tags Rendering

I have add a custom plugin that insert custom tags into my tinyMCE editor of the format:
title
I want the custom tags to be rendered with some styles when viewed in the WYSIWYG view. I have seen one response to a similar question :
http://topsecretproject.finitestatemachine.com/2010/02/how-to-custom-tags-with-tinymce/
but this doesn't work - they tags are not stripped out but they are not styled either??
You need to use the content_css initialisation parameter:
content_css: my_css_file.css
containing something like
title {
// css here
}