litchfield / django-liststyle

Style your django admin changelist rows with ease!
BSD 3-Clause "New" or "Revised" License
35 stars 27 forks source link

row styling with get_row_css failing #13

Open thesunlover opened 7 years ago

thesunlover commented 7 years ago

I'm using Django==1.11.5 python2.7 django-liststyle==0.2b not working with django-liststyle==0.2b0 as well

In My settings:

 INSTALLED_APPS = [
     'liststyle',  # required to be above 'django.contrib.admin'
     # default
     'django.contrib.admin',

In my admin.py file

class MyAdmin(ListStyleAdminMixin, admin.ModelAdmin):
    class Meta:
        model = MyModel
    def get_row_css(self, obj, index):
        1/0 # doesn't break in here
        if obj.status == STATUS_REJECTED:
            return 'red red%d' % index
        elif obj.status == STATUS_WAITING:
            return 'orange orange%d' % index
        return ''

TemplateSyntaxError: 'future' is not a registered tag library. Must be one of: admin_list admin_modify admin_static admin_urls cache highlighting i18n indent_text l10n liststyle_tags log rest_framework static staticfiles syntax_color thumbnail truncate_letters tz widont

if you need additional information please ask

AuHau commented 6 years ago

This is because since Django 1.10 the future library was dropped as it was prepare migration to new behavior of cycle tag. The fix is as easy as removing the future import.

@fabriceb already done it in his fork, but I am not sure why he had not made PR with his fix...

You can use temporarily his fork by installing with pip install git+https://github.com/fabriceb/django-liststyle.git@cac1461939f4d7eedf2b8d144ce89da943791a7e