How do you enable an archives tab on a pelican powered blog?
I see from the docs that it is a direct template by default, but it isn't showing up on my blog. Is there some additional field to enable it? I couldn't find any mention of it in the docs or tutorials, so I'm assuming I've missed something obvious.
Not sure if you ever resolved this; I was having the same issue as you with pelican's bootstrap3 theme. For some reason, setting a value for YEAR_ARCHIVE_SAVE_AS was not working.
After looking at the theme's base.html file, I got it working by adding the following to pelicanconf.py:
ARCHIVES_SAVE_AS = 'archives.html'
Lines 156-158 from my base.html file:
{% if ARCHIVES_SAVE_AS %}
<li><i class="fa fa-th-list"></i><span class="icon-label">{{ _('Archives') }}</span></li>
{% endif %}
Related
I am trying to use Django-Postman and have gotten as far as being able to see the templates on the webpage after I press the link but I don't know how send messages works. According to the write view there should be a form loaded but all I get is the links to the other pages in the template. If someone could explain how to get this to work it would be fantastic.
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav ">
<li>MyCourse</li>
<li>Timetable</li>
<li>logout</li>
<li>Inbox</li>
</ul>
</div>
Recently had to set up postman myself, and based just off your snippet, I'm going to assume you wrote the ul element yourself.
So, if that's the case, postman actually expects to handle all of that for you. According to the docs, you need to create a base.html template inside your own template directory. A few blocks are expected to be present inside this template, namely {% title %} (text it will add to the page's title), {% extrahead %} (some extra js and css), {% content %} (would contain the missing forms you're looking for) and {% postman_menu %} (the menu links automatically generated by postman).
You could always create the menu links yourself, but I'd suggest you create a /postman folder in your app's template folder, then copy the base.html from the installed postman app (this contains the code for how to layout the ul). Just a little more django-esque, and usefull if you need to fiddle with the names of the template tags, etc, but that's up to you.
Hope this helps, happy coding.
I am pretty new to Django. I am fiddling with zinnia to customize it and setting it up with my own theme/template etc. The main content displayed in the default template is following:
{% for object in object_list %}
{% include object.content_template with object_content=object.html_preview continue_reading=1 %}
{% empty %}
I understand that include includes the template inside a page. But what I cannot comprehend is: how do I find the relevant template being rendered? What is content_template? Please help me in understanding this snippet.
The template name (content_template) is being fetched from the database. It is a property of the model ContentTemplateEntry and defaults to zinnia/_entry_detail.html.
I'm trying to include a youtube like up and down voting feature for my blog. I have used pip install django-updown to install this to my project. I have followed all the instructions there.
I have included updown to INSTALLED_APPS, included rating = RatingField() to my models.py file and also included the url as described. But, the problem is, I can't see the voting system in my blog? I'm guessing it is something to do with the template file since nothing has been mentioned about it.
I have the following commenting form in my template and would like the up-down vote to be shown before this. Can anyone help me out? Thanks :)
<div class="comment_form">
{% if user.is_authenticated %}
{% get_comment_form for object as form %}
.....
{% else %}
<p>Please log in to leave a comment.</p>
{% endif %}
</div>
Maybe there is a problem with my urls.py file?
This is the url for my individual blog post:
url(r'^book/(?P<pk>\d+)$', BookDetail.as_view(), name='book-detail'),
Following the documentation mentioned in the source documentation, I included:
url(r'^book/(?P<object_id>\d+)/rate/(?P<score>[\d\-]+)$', AddRatingFromModel(), {
'app_label': 'bookBlog',
'model': 'Book',
'field_name': 'rating',
name="book_rating"),
From django-updown github:
To submit a vote just go to video/<id>/rate/(1|-1).
If you allowed users to change they're vote, they can do it with the same url.
Try following that URL directly and check if your votes are being added or not. If it is working, i guess you could just set some links to that view or something (or send some ajax requests).
I am working on a small project and I thought I'd give wagtail a try. I am now wondering how I could change wagtail's admin logo in the sidebar (top left image on the picture bellow).
I could change /static/wagtailadmin/images/wagtail-logo.svg directly but it'd be wrong ;).
Wagtail already provide the solution in the official documentation using django-overextends:
To replace the default logo, create a template file your_app/templates/wagtailadmin/base.html that overrides the block branding_logo as follow:
{% overextends "wagtailadmin/base.html" %}
{% block branding_logo %}
<img src="{{ STATIC_URL }}images/custom-logo.svg" alt="Custom Project" width="80" />
{% endblock %}
Check Wagtail Custom branding for more details.
(Edit Dec - 2020)
Note: In the latests versions of Wagtail django-overextends is not needed anymore. It uses now the default extends tag of Django templates. Consult the docs for more information
The logo is defined here:
https://github.com/torchbox/wagtail/blob/master/wagtail/wagtailadmin/templates/wagtailadmin/base.html#L7
To override it, you'll need an app which contains templates/wagtailadmin/base.html and precedes wagtail in INSTALLED_APPS.
Good luck!
I'm trying to add features to Django 1.2 admin's main page.
I've been playing with index.html, but features added to this page affect all app pages.
Any ideas on what template I'm supposed to use?
Thanks loads!!
You can use template hierarchy like:
index.html
...
{% block content %}
...
{% block mycontent %}My custom text{% endblock %}
...
{% endblock %}
app_index.html
...
{% block mycontent %}{% endblock %}
..
According to http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overriding-vs-replacing-an-admin-template you will want to override admin/app_index.html
I have done this by modifying the admin/index.html template. You may also need to modify admin/base_site.html (depending on what you want to do, exactly).
These templates are found in the django/contrib/admin/templates/admin folder in a Django installation.
Update: That's exactly what I've done, see the screenshot fragment below. The section marked in red is the section I added, via HTML in admin/index.html. However, you don't say which version of Django you're using - my example is from a 1.0 installation.