Coder Social home page Coder Social logo

arpadmuller / django-admin-bootstrap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from douglasmiranda/django-admin-bootstrap

0.0 0.0 0.0 2.36 MB

Responsive Theme for Django Admin With Sidebar Menu

License: MIT License

Makefile 0.47% HTML 95.20% Python 4.32%

django-admin-bootstrap's Introduction

Responsive Django Admin

If you're looking for a version compatible with Django 1.8 just install 0.3.7.1.

Features

  • Responsive
  • Sidebar Menu
  • Easy install / setup
  • Support Django 1.11, 2.1, 2.2 and 3.0
  • Bootstrap 3
  • Python 3

Screenshots

See Screenshots

More screenshots

INSTALL

from pypi (recommended) :

$ pip install bootstrap-admin

And don't forget to add bootstrap_admin in INSTALLED_APPS before the django.contrib.admin.

Example:

INSTALLED_APPS = (
    # ...
    'bootstrap_admin', # always before django.contrib.admin  
    'django.contrib.admin',
    # ...
)  

CUSTOMIZE

Sidebar Menu

It is enabled by default. But if you remove django.template.context_processors.request from your context_processors.

Just disable it:

BOOTSTRAP_ADMIN_SIDEBAR_MENU = False

If you want to use your own logo, you can achieve this by overriding the login.html and base_site.html, just like in Django Admin.

First, make sure the TEMPLATES setting in your settings.py is properly configured:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'my_django_project/templates')],
        'APP_DIRS': True,
        # other stuff
    },
]

`DIRS`: You must set the location of your templates, an absolute path.

I'm assuming BASE_DIR is:

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

This pattern of creating a global templates folder could be useful for you to use for your base.html and other global templates.

More info: https://docs.djangoproject.com/en/2.1/ref/templates/api/#configuring-an-engine

Let me show you a project structure as an example:

├── my_django_project
│   ├── core
│   │   ├── admin.py
│   │   ├── apps.py
│   │   ├── models.py
│   │   ├── tests.py
│   │   └── views.py
│   ├── settings.py
│   ├── templates
│   │   └── admin
│   │       ├── base_site.html
│   │       └── login.html
│   ├── urls.py
│   └── wsgi.py
├── manage.py

You can see I created a global templates/ folder, with another directory inside admin/ containing login.html and base_site.html.

Their respective contents are:

base_site.html

{% extends 'admin/base_site.html' %}
{% load static %}

{% block branding %}
    <a href="{% url 'admin:index' %}" class="django-admin-logo">
        <!-- Django Administration -->
        <img height="60" src="{% static "bootstrap_admin/img/logo-140x60.png" %}" alt="{{ site_header|default:_('Django administration') }}">
    </a>
{% endblock branding %}

login.html

{% extends 'admin/login.html' %}
{% load i18n static %}

{% block branding %}
    <a href="{% url 'admin:index' %}" class="django-admin-logo">
        <!-- Django Administration -->
        <img height="60" src="{% static "bootstrap_admin/img/logo-140x60.png" %}" alt="{{ site_header|default:_('Django administration') }}">
    </a>
{% endblock branding %}

More info: https://docs.djangoproject.com/en/2.1/ref/contrib/admin/#admin-overriding-templates

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request =]

See the full list of contributors.

Open an issue if you find a bug or want something more.

django-admin-bootstrap's People

Contributors

douglasmiranda avatar alrusdi avatar ejnens avatar nanuxbe avatar gilsonbp avatar gustavosoares avatar twidi avatar jpic avatar ajakubo1 avatar cristobalmackenzie avatar dlareau avatar jscissr avatar ls-initiatives avatar maoaiz avatar michaelkuty avatar iammiraclealex avatar oriadam avatar pbojinov avatar seether85 avatar seha16 avatar children1987 avatar ygneo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.