Giter VIP home page Giter VIP logo

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

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-admin-bootstrap's Issues

What is the proper way to provide a custom logo?

The side bar menu now shows a logo saying: "Django admin", using the image found in the bootstrap_admin template: bootstrap_admin/static/img/logo-140x60.png.

What is the best way to change this to my own custom logo in my app?

No module named apps

from django.apps import apps

'bootstrap_admin_template_tags' is not a valid tag library: ImportError raised loading bootstrap_admin.templatetags.bootstrap_admin_template_tags: No module named apps

branch django1.7_bootstrap_3

Overriding admin templates

Hey, Thanks for putting this together its great stuff.

Question:
How do you override the admin templates to put in a new title or header into the admin?

Thanks.

Bootstrap admin overwrites default widget classes

In the current implementation bootstrap_admin overwrites the original widget's class attribute.
Some widgets like bootstrap specific widgets or the widgets from modeltranslation have specific classes and those should not be overridden.

fieldsets: fields in same line

When settings multiple fields in same line, using fieldsets seems not working (?)

fieldsets = ( ('Digite os valores do produto', { 'fields': (('inicial','final','desconto'),) }), )

image

Responsive collapse menu

Although you have the responsive loaded in the template, I can't get it to collapse the navbar at the top. I have a working set in my template, but try to use the same code inside the admin section and it doesn't work on tablets/phones.

NoReverseMatch at /admin/

Hi, I'm getting this error:

NoReverseMatch at /admin/
Reverse for 'auth_user_change' with arguments '(1L,)' and keyword arguments '{}' not found.

Error during template rendering

In template /Volumes/Data/Projects/realcodelab/ejc/venv/lib/python2.7/site-packages/bootstrap_admin/templates/admin/base.html, error at line 40
Reverse for 'auth_user_change' with arguments '(1L,)' and keyword arguments '{}' not found.

Django Admin i18n compatibility

templates/admin/change_list.html
line 98 is

{% trans 'Filters' %} 

should be

{% trans 'Filter' %} 

to make it i18n Django compatible.

A Cross Site Scripting vulnerability at admin login page

Because of using firstof tag, username parameter is not escaped correctly.

Example:
Accept text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Connection keep-alive
Cookie csrftoken=LJSSfgPF4kTPEGgNwi3GBKy1YfvTOOEV; sessionid=murf8mx6aifgjklpenyjvs8ujg4n0baj
Host 127.0.0.1:8001
Referer http://127.0.0.1:8001/admin/
User-Agent Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:30.0) Gecko/20100101 Firefox/30.0

csrfmiddlewaretoken=LJSSfgPF4kTPEGgNwi3GBKy1YfvTOOEV&username=username%22+%2F%3E%3Cscript%3Ealert%28%22XSS%22%29%3B%3C%2Fscript%3E&password=&this_is_the_login_form=1&next=%2Fadmin%2F

Tested on:
Django==1.5.8
bootstrap-admin==0.3.0

Filters pop up when panel loads

Hello, thanks for this great integration, I have just had a first glance and I love it!

Every time I open a panel for any of my apps that has filters, this filter pops up immediately, unasked. Any idea how to fix this?

I attach an image that shows it clearly.

Thanks!
GhrY45q

jquery not working in browser's console

I don't know if this issue is in anyway related to django-admin-bootstrap, but do you manage do send jquery calls through's the browser console panel? Check it out the following example:

$("a");
TypeError: undefined is not a function

I've tested the above example in others django applications and it worked flawlessly.

Adds an extra item using inlines

class OrderItemInline(admin.StackedInline): model = OrderItem extra = 0

results in 2 items in the form. If I disable the admin-bootstrap then it works as expected.

Screen-Shot-2013-01-31-at-3 44 18-PM

Bug on Sidebar when "Customizing the AdminSite class"

When customizing the AdminSite class, the apps and models registered in this new admin appear in the app list but not in sidebar menu.

from django.contrib.admin import AdminSite

from .models import MyModel

class MyAdminSite(AdminSite):
    site_header = 'Monty Python administration'

admin_site = MyAdminSite(name='myadmin')
admin_site.register(MyModel)  

https://docs.djangoproject.com/en/dev/ref/contrib/admin/#customizing-the-adminsite-class

This happens because I'm using:

from django.contrib.admin import site
# ...
def render_menu_app_list(context):
    # ...
    for model, model_admin in site._registry.items():
#...

https://github.com/douglasmiranda/django-admin-bootstrap/blob/master/bootstrap_admin/templatetags/bootstrap_admin_template_tags.py

And site only have those apps registered in admin_site.name='admin' but not those registered in 'myadmin'.

( Need more coffee and think about this, but if someone have an idea let me know. =] )

Error in list view

erro
When I have to list the "rows" of my table, the "DO" button is breaking down.
It would be great to have it working perfectly

submenu overlaps top menu items

The submenu with search and filter that is "sticky" (stays on top when you scroll down), stays above the main top fixed menu (meaning any dropdowns in the main menu are hidden by the filter menu when opened).

how it run?

the project missing manage.py,can i run this project,i am a fresh man! thank you

Messages not being displayed

If you set a message_user(request, 'some message') in your Custom Admin model, not message is displayed on the page (cookie is set, etc), but I think you are missing the code in the templates to display messages (from django.contrib.message package).
Could you add that?

Thanks,

About django-mptt and django reversion

I will work on django-admin-bootstrap to support Django 1.7 and upgrade the bootstrap, so we can enjoy the new clean and beautiful Bootstrap 3.

I will remove the django-mptt and django-reversion templates, but the maintainers could create django packages, submit to pypi as a django-admin-bootstrap component/extension.

However I will start working on #43 and #39

PS: The purpose of django-admin-bootstrap is to be a theme for django-admin, and not implement other complex features. So I will try to keep it always simple as possible.

django-filer

django-filer do not show directiories and files with django-admin-bootstrap.
When replace templated with original django-filer templates - upload files do not work anymore

Collapsible field sets are not shown

A field set with class "collapse" doesn't show up in the rendered form.
Example from the django tutorial:

class QuestionAdmin(admin.ModelAdmin):
    fieldsets = [
        (None,               {'fields': ['question_text']}),
        ('Date information', {'fields': ['pub_date'], 'classes': ['collapse']}),
    ]

Here the 'date information' will not show...

Multiple choices for filters

Hello, I'm trying to filter table results with more than a parameter for the same category of filter.
For example, in a table of cities:
"All cities in Virginia AND in Nevada".
Right now I can't seem to be able to do that, as I can only pick either a single state, or all of them.
Would it be possible to do it somehow?
Thanks

Some filter options are inaccessible in admin

When the browser has a wide max-width, the filter bar gets fixed to the top of the viewport. In the case that a filter criterion has numerous options (20+), this causes the list to extend off the bottom of the window -- leaving the end of the list inaccessible.

At narrower browser widths, this is not an issue as the filter bar does not get fixed.

A quick and dirty solution is to apply a max height and overflow scroll:

.dropdown-submenu:hover>.dropdown-menu {
max-height: 20em;
overflow-y: scroll;
}

pip install bootstrap-admin Throws: IOError: [Errno 2] No such file or directory

Steps to reproduce the error:

  • Create a new virtualenv
  • Run: pip install bootstrap-admin
  • The error show:
Downloading/unpacking bootstrap-admin
  Downloading bootstrap_admin-0.2.0.tar.gz (234kB): 234kB downloaded
  Running setup.py egg_info for package bootstrap-admin
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/home/jfunez/Work/Environments/brutus/build/bootstrap-admin/setup.py", line 5, in <module>
        f = open(os.path.join(os.path.dirname(__file__), 'README.md'))
    IOError: [Errno 2] No such file or directory: '/home/jfunez/Work/Environments/brutus/build/bootstrap-admin/README.md'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/home/jfunez/Work/Environments/brutus/build/bootstrap-admin/setup.py", line 5, in <module>

    f = open(os.path.join(os.path.dirname(__file__), 'README.md'))

IOError: [Errno 2] No such file or directory: '/home/jfunez/Work/Environments/brutus/build/bootstrap-admin/README.md'

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /home/jfunez/Work/Environments/brutus/build/bootstrap-admin
Storing complete log in /home/jfunez/.pip/pip.log

Same error if run: pip install bootstrap-admin==0.1.5
It works if run: pip install git+https://github.com/douglasmiranda/django-admin-bootstrap

Add tests

Need to add tests. Mostly for the custom template tags.

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.