douglasmiranda / django-admin-bootstrap

Responsive Theme for Django Admin With Sidebar Menu
MIT License
879 stars 233 forks source link

compatibility with Django 2.0 #115

Closed vpodpecan closed 6 years ago

vpodpecan commented 6 years ago

To ensure Django 2.0 compatibility, in the bootstrap_admin_template_tags.py the import

from django.core.urlresolvers import reverse, NoReverseMatch

should be changed to

from django.urls import reverse, NoReverseMatch

because Django 2.0 removed the django.core.urlresolvers module (moved to django.urls with Django 1.10).

douglasmiranda commented 6 years ago

112 will fix this issue =]

maxdoom-com commented 6 years ago

Hi. I tried it fixing locally. In bootstrap_admin_template_tags.py line 69

@register.assignment_tag
def display_sidebar_menu(has_filters=False):

will have to be changed to @register.simple_tag because assignment_tag was removed in django 2.

Btw.: It seem like an admin.ModelAdmin with fieldsets = ( ... 'classes': ('collapse',), ... ) will vanish, when I click "show".

This is really a wonderful project!

douglasmiranda commented 6 years ago

Hello @maxdoom-com, I couldn't replicate your issue about collapsed fieldsets.

Typically this happens when you use default class collapsed on a fieldset with no fieldset name:

fieldsets = (                                                                   
    (None, {'classes': ('collapse',),  'fields': ('username', 'password')}),
)

Instead of:

fieldsets = (                                                                   
    ("Account Info", {'classes': ('collapse',),  'fields': ('username', 'password')}),
)

This happens on Django Admin (without django-admin-bootstrap) too.

douglasmiranda commented 6 years ago

Closing this, fixed on master.

And about the collapsed stuff, it may be related to #116

If yes, it's fixed on master, try the next release, coming soon. If it persists, open another issue with the steps to reproduce.

douglasmiranda commented 6 years ago

https://github.com/douglasmiranda/django-admin-bootstrap/releases/tag/0.3.9