Hide Django logo/name in header Django admin tool - django

I want to hide/change the name displayed in the header bar, the label that I want to change is "DJANGO" word as the next image shows"

Another solution for customizing the admin header.
Just copy /django/contrib/admin/templates/admin/base_site.html from django source (Link Here) and paste it under your templates directory.
For example,
your_project/templates/admin/base_site.html
Now you can change whatever you like in this template.
Hope this helps.

The easiest way is to simply add the following lines to your main urls.py:
admin.site.site_title = 'My Heading'
admin.site.site_header = 'My Heading'
admin.site.index_title = 'My Heading'
See the Django documentation for more attributes.

make a custom template file like:
templates/admin/base_site.html
{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}YOUR WEB TITLE{% endblock %}
{% block branding %}
<h1 id="site-name">Your Site Name</h1>
{% endblock %}
{% block extrahead %}
<style type="text/css">
#header #branding h1{
background: None; // here you remove the django image
}
</style>
{% endblock %}

Just Share improve with favicon icon :
{% extends "admin/base.html" %}
**{% load staticfiles %}**
{% block title %}BROKR System{% endblock %}
{% block extrahead %}
**<link rel="shortcut icon" href="{% static 'img/logo1.png' %}"/>**
{% endblock %}
{% block branding %}
<h1 id="site-name">BROKR System</h1>
{% endblock %}
{% block nav-global %}{% endblock %}

You will need to locate your
django/contrib/admin/templates/admin/base.html
This might be located in your
env/lib/site-packages
Thus, you find it in
env/lib/site-packages/django/contrib/admin/templates/admin/base.html
This is if you have virtual environment setup.
Else it will be in your base project folder containing your settings.py, wsgi.py etc
In:
your_base_folder/lib/site-packages/django/contrib/admin/templates/admin/base.html
Then go to line 32-34
<div id="branding">{% block branding %}{% endblock %}</div>
Replace the below with your img or text or h1
{% block branding %}{% endblock %}
For example:
<div id="branding"><img href='example.png'></div>
Or You could use the preferred django's
{{% url (bla.bla bla) %}}

Related

No content visible in django-bootstrap3

I am using Django 1.9 and demo template structure to display home.html.
I have included the following in the base.html file:
{% block bootstrap3_content %}
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
...
</div>
</nav>
<div class="container-fluid">
{% autoescape off %}{% bootstrap_messages %}{% endautoescape %}
{% block content %}(no content){% endblock %}
</div>
{% endblock %}
Navbar shows successfully but I do not get the Bootstrap message in the container below?
I am a new user to Django and this App as well. Please help!
Edit1:
bootstrap.html extends bootstrap3.html; base.html extends bootstrap.html; home.html extends base.html.
home.html
{% block title %}My_title{% endblock %}
{% block content %} This is <em>bootstrap3</em> for <strong>Django</strong>.
{% endblock %}
I get the title in the navbar but no message inside content block.
Make sure that you have
{% load bootstrap3 %}
at the top of your page since you are using this module. Make sure that you have
'bootstrap3',
in your installed apps.
From your code it looks like you are extending a template. If you are, be sure to have a
{% extends FooTemplate.html %}
in case you are loading boostrap3 in the parent template.

Djangocms template not showing up

I have a basic DjangoCMS up and running.
base.html contains:
{% block content %}{% endblock content %}
I also have feature.html:
{% extends "base.html" %}
{% load cms_tags %}
{% block title %}{% page_attribute "page_title" %}{% endblock title %}
{% block content %}
<div>
{% placeholder "feature2" %}
</div>
<div class="jumbotron"">
{% placeholder "feature" %}
</div>
<div>
{% placeholder "content" %}
</div>
{% endblock content %}
I added the "feature2" placeholder in the above, and it correctly displays for editing on the site.
I then added a new line to base.html:
{% block base_logo %}{% endblock base_logo %}
and created a new file, base_logo.html:
{% extends "base.html" %}
{% load cms_tags %}
{% block base_logo %}
<div>
{% placeholder logo %}
</div>
{% endblock base_logo %}
I expected this to also appear on the site for editing, but it doesnt. I have added the base_logo.html to the CMS_TEMPLATES in settings.py and TEMPLATE_DIR is also pointing correctly.
What else do I need to do for Djangocms to pick up my new template?
Take a look at template inheritance.
You're trying to use two {% extends %} tags, which won't work. You should use the {% include %} tag for base_logo, because it seems you'd want to include this in many templates. This question provides more info.

Overriding "Add user" header in django admin

How can I change the text at the top of the add user page? I am talking about the text in this section:
I've been reading the docs and searching through the code, but I'm not finding the place to override this.
This text is defined in the admin/auth/user/add_form.html template. To override it create your own template with the same name in your project.
EXAMPLE:
{% extends "admin/change_form.html" %}
{% block content_title %}
<h1>This is the title</h1>
{% endblock %}
{% block form_top %}
<p>This is the subtitle</p>
{% endblock %}
{% block after_field_sets %}
<script type="text/javascript">document.getElementById("id_username").focus();</script>
{% endblock %}

Django Admin Login Background

how can i change only background image of admin login site in django? i have tried some method but didnt achieved.
i have put base_site.html to under templates\admin.
what is next for coding about background image?
{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %}
{% block extrastyle %}
<style type="text/css">
# body {background-color: #444444;}
</style>
{% endblock %}
{% block branding %}
<h1 id="site-name">{% trans 'Admin Login' %}</h1>
{% endblock %}
{% block nav-global %}{% endblock %}
The correct code is:
{% block extrastyle %}
<style type="text/css">
body.login {background-color: #444444;}
</style>
{% endblock %}
The problem was the # in the css which refers to an id, ie <some_tag id="body"> rather than <body>. body.login targets a body tag with a login class, ie <body class="login">, which is what the django admin site uses to identify the body of just the login screen.

Issue trying to customizing the admin in Django

In order to add some links in the admin of my site I added a custom block (surrounded in red in the images below) to admin/base.html and set it in admin/base_site.html.
The issue is that it's shown in all admin pages (eg connexion screenshot shown below), while I'd like to show it only in the site admin first page.
Anybody could help?
admin/base.html
...
<!-- Content -->
<div id="content" class="{% block coltype %}colM{% endblock %}">
{% block pretitle %}{% endblock %}
{% block content_title %}{% if title %}<h1>{{ title }}</h1>{% endif %}{% endblock %}
{% block content %}
{% block object-tools %}{% endblock %}
{{ content }}
{% endblock %}
{% block sidebar %}{% endblock %}
{% block myblock %}{% endblock %} <!-- custom block -->
<br class="clear" />
</div>
<!-- END Content -->
....
admin/base_site.html
....
{% extends "admin/base.html" %}
{% load i18n %}
{% block title %}{{ title }} | {% trans 'Django site admin' %}{% endblock %}
{% block branding %}
<h1 id="site-name">{% trans 'Administration de Django' %}</h1>
{% endblock %}
{% block nav-global %}{% endblock %}
{% block myblock %}
<div style="margin-top:160px;">
<div style="font-size:18px; color:#666666;font-weight:bold;margin-bottom:10px;">Rapports</div>
Rapports journaliers<br/>
Rapports mensuels
</div>
{% endblock %}
....
Site admin
Connexion
Then you are better off overriding admin/index.html
For this purpose I would like to recommend to you django-admin-tools application. As documentation says:
django-admin-tools is a collection of extensions/tools for the default
django administration interface, it includes:
a full featured and customizable dashboard;
a customizable menu bar;
tools to make admin theming easier.
Please join the mailing list if you want to discuss of the future of django-admin-tools.