Django 1.5 html issue, href does not appear - html

Hi i'm having some problems with Django 1.5. I'm writing a simple template but i can't display an link (href tag) into my page.
this is my code
{% extends "forum_base.html" %}
{% load uni_form_tags %}
{% block title %}Lista dei Forums{% endblock %}
{% block content %}
<h3></h3> >> <h3></h3>
{% for forum in forums %}
<h3>{{ forum.title }}</h3>
{% endfor %}
{% endblock %}
i cannot display this line :
<h3></h3> >> <h3></h3>
Can someone explain me where is the error?

Its a html issue.
<h3>YOURTEXTHERE</h3> >> <h3>YOURTEXTHERE</h3>

Related

What is the "base" file that the Bokeh index.html extends?

I am a little confused about what {% extends base %} is extending at the start of index.html in Bokeh server application packages.
Examples of this can be seen in:
Bokeh Docs: Embedding in Templates
{% extends base %}
{% block contents %}
<div>
<p> Hello {{ user_id }}, AKA '{{ last_name }}, {{ first_name }}'! </p>
</div>
{% endblock %}
Bokeh Server Application Examples
Example code from the Gapminder package in templates/index.html
{% extends base %}
{% block title %}Bokeh Gapminder Example{% endblock %}
{% block postamble %}
<style>
{% include 'styles.css' %}
</style>
{% endblock %}
What is this "base" that is being extended?
I see that there is a "contents" block, "title" block, and "postamble" block from the above examples.
How do I know what other jinja blocks I can modify?
Thanks.

why i don't see all parts in html using django

I wrote the following code:
{% extends "base.html" %}
{% block content %}
{% if all_site %}
<ul>
<h3>Here all my site:</h3>
{% for site in all_site %}
<li> {{ site.name }}</li>
{% endfor %}
</ul>
{% else %}
<h3> You don't have any Site.</h3>
{% endif %}
{% endblock content %}
when, I run. I not see "Here all my site", but I only see the one contained in the for.
I tried to modify it, for now a solution that I have found working is this:
{% extends "base.html" %}
{% block content %}
{% if all_site %}
<h3>mmmmmm</h3>
<ul>
<h3>Here all my site:</h3>
{% for site in all_site %}
<li> {{ site.name }}</li>
{% endfor %}
</ul>
{% else %}
<h3> You don't have any Site.</h3>
{% endif %}
{% endblock content %}
in this case if I do run, i see:
here all my site:
site 1
site 2

How do I hide a specific tag from a Shopify navigation?

we are trying to hide a specific tag/filter from one of our collection pages' navigations without deleting the tag from the products themselves as we still need this tag for other functionalities.
Our theme is pretty custom and I've tried some different variations of liquid code, but to no avail.
collection page navigation with tag needed to hide
I've attached a screen shot highlighting the tag we need to hide from the nav.
Here is the URL to that page: https://mycuisinesolutions.com/collections/all
Here is the code which dynamically pulls in all tags for that nav:
{% if collection.all_tags.size > 0 %}
<div class="tags">
{% for tag in collection.all_tags %}
{% capture tag_slug %}{{ tag | handleize }}{% endcapture %}
{{ tag }}
{% endfor %}
</div>
{% endif %}
If anyone could be of assistance or needs more information, please let me know.
I've tried adding
{% unless product.tags contains 'no-quantity' %}
--tag code above--
{% endunless %}
but this did not work. Any help is much appreciated!
You're trying to check the product.tags on some reason. You need to check the tag itself in the loop. The below code should work for you.
{% if collection.all_tags.size > 0 %}
<div class="tags">
{% for tag in collection.all_tags %}
{% capture tag_slug %}{{ tag | handleize }}{% endcapture %}
{%- if tag_slug == "no-quantity" -%}
{%- continue -%}
{%- endif -%}
{{ tag }}
{% endfor %}
</div>
{% endif %}

blog tag produces error right after if statement

I am trying to render three columns for per row in my html file by using Django2.1 and Bootstrap4.
The piece of HTML code looks like following:
<main class="container" role="main">
{% for treasure in treasures %}
{% block row %}
<div class="col-sm-4 py-2">
<div class="card card-body h-100">
<h4 class="card-title">{{ treasure.name }} </h4>
<img class="card-img-bottom mw-100 mh-100" src="{{ treasure.img_url }}" alt="A Kind of Treasure">
</div>
</div>
{% if forloop.counter|divisibleby:3 %}
{% endblock %} {% block row %}
{% endif %}
{% endblock %}
{% endfor %}
</main>
The error I get is:
Invalid block tag on line 44: 'endblock', expected 'elif', 'else' or 'endif'. Did you forget to register or load this tag?
PS: Line 44 is {% endblock %} {% block row %}, so I get the error right after the if check. If I delete that line, it does not produce any error.
Your first {% endblock %} tag is overlapping with the {% if forloop.counter|divisibleby:3 %} tag.
You are basically doing the following:
{% block row %}
{% if forloop.counter|divisibleby:3 %}
{% endblock %}
{% block row %}
{% endif %}
{% endblock %}
Your if tag and endif tag are in two separate blocks, this is causing the error. You wil have to remove the block tags between the if tags.
Adding to the previous answer, you can rename your blocks, and for clarity, add the name in the endblock tag.
{% for treasure in treasures %}
{% block row %}
...
{% if forloop.counter|divisibleby:3 %}
{% block row2 %}
{% endblock row2 %} # add the name in endblock for clarity
{% endif %}
{% endblock row %} # add the name in endblock for clarity
{% endfor %}

All pictures adjusted automatically to left on blog

All pictures adjusted automatically to left on blog
I have created page here: http://dzikuss98.pythonanywhere.com/ using django
As you see all pictures are aligned to left even during creation of post they were in middle
below you can see my blog template:
{% extends "personal/header.html" %}
{% block content %}
{% for post in object_list %}
{% autoescape off %}
<h5>{{ post.date|date:"Y-m-d" }} <b> {{ post.title }}</b></h5>
{{ post.body|linebreaks|truncatechars:300 }}
{% endautoescape %}
{% endfor %}
{% endblock %}
I use WYSIWG editor