PetrDlouhy / django-related-admin

Allow foreign key attributes in list_display with '__'
BSD 3-Clause "New" or "Revised" License
69 stars 13 forks source link

Automatic detection of boolean fields #7

Closed theY4Kman closed 7 years ago

theY4Kman commented 7 years ago

Adds support for automatically detecting boolean fields, so you can get selection_014

Instead of selection_015

By only listing the field in list_display (like vanilla Django)

class AlbumAdmin(RelatedFieldAdmin):
    list_display = ('artist__active',)

And without requiring an explicit boolean=True:

class AlbumAdmin(RelatedFieldAdmin):
    list_display = ('artist__active',)

    # Not needed
    artist__active = getter_for_related_field('artist__active', boolean=True)
coveralls commented 7 years ago

Coverage Status

Coverage decreased (-6.5%) to 93.548% when pulling ddda839e3cb7689c53e43bb9e1278c86e4023b41 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-6.5%) to 93.548% when pulling ddda839e3cb7689c53e43bb9e1278c86e4023b41 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

theY4Kman commented 7 years ago

Done, done, and done. Will that note do, or would you like something more substantial?

Also, I'll squash the commits before you merge.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.3%) to 97.674% when pulling 001322ea917b1db98f1db2600fb039f96bee2726 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.6%) to 97.368% when pulling cdb8c70e384de37ead91b30df8b73abdb62f5c54 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.6%) to 97.368% when pulling cdb8c70e384de37ead91b30df8b73abdb62f5c54 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

theY4Kman commented 7 years ago

Er, did I break something on that flake8 test? https://travis-ci.org/PetrDlouhy/django-related-admin/jobs/223329049

PetrDlouhy commented 7 years ago

@theY4Kman flake8-class disappeared from PyPI. Please, remove it from deps and you will be OK.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-2.6%) to 97.368% when pulling b12cabb7c75fa037592ae27c19f730fa5c80f4bc on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

theY4Kman commented 7 years ago

Okie dokes, that should cover everything. If you're satisfied, I'll go ahead and squash.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 34ea8c8b4fb3090e4bde48e1f9ce8a19402b36a9 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 34ea8c8b4fb3090e4bde48e1f9ce8a19402b36a9 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 34ea8c8b4fb3090e4bde48e1f9ce8a19402b36a9 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 34ea8c8b4fb3090e4bde48e1f9ce8a19402b36a9 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling 34ea8c8b4fb3090e4bde48e1f9ce8a19402b36a9 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

PetrDlouhy commented 7 years ago

Nice, I like it. Please squash and add one more commit - bump the version to 0.5.0.

I will release version 1.0.0 after some time this version will be alive without bugs.

theY4Kman commented 7 years ago

Done and done. I left the flake8 fix as a separate commit, since it seemed unrelated.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.4%) to 98.649% when pulling 4e58322b47a49623e4d5d53afdaf8f4ba3c89c35 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.4%) to 98.649% when pulling 4e58322b47a49623e4d5d53afdaf8f4ba3c89c35 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage decreased (-1.4%) to 98.649% when pulling 4e58322b47a49623e4d5d53afdaf8f4ba3c89c35 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling fca7e3d88ad2695e9533052cbbafcae4a5585294 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

coveralls commented 7 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling fca7e3d88ad2695e9533052cbbafcae4a5585294 on theY4Kman:master into 1c42dcd467d3595e9ceb46aa49ac340f8af95dc2 on PetrDlouhy:master.

PetrDlouhy commented 7 years ago

@theY4Kman Merged and now also released on PyPI. Thanks for your contribution.

theY4Kman commented 7 years ago

Kick-ass :D Thanks for the project. I was a bit taken aback by the lack of relationship support in list_display and the Django project's outright refusal to address it. This project definitely stopped me from jamming my foot in someone's rear ;)