Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List filter options being repeated when using mixins #14

Closed
buswedg opened this issue Jan 26, 2023 · 2 comments
Closed

List filter options being repeated when using mixins #14

buswedg opened this issue Jan 26, 2023 · 2 comments

Comments

@buswedg
Copy link

buswedg commented Jan 26, 2023

I'm not sure if this is intended behavior, but I noticed this morning that the generated admin.py is repeating list_filter options. And seems to be related to whether those fields are related fields, or included via a model mixin.

An example output for model 'ProfileLocation' below:

class ProfileLocationAdmin(admin.ModelAdmin):

    list_display = ('id', 'created_at', 'modified_at', 'profile', 'location')
    list_filter = (
        'created_at',
        'modified_at',
        'profile',
        'location',
        'id',
        'created_at',
        'modified_at',
        'profile',
        'location',
    )
    date_hierarchy = 'created_at'

created_at and modified_at are both datetimefields which are included via a modelmixin. While profile is a onetoone and location is a fk field.

@wolph
Copy link
Owner

wolph commented Feb 6, 2023

That's definitely a bug... I've noticed it before but forgot to fix it. Thanks for reminding me!

@wolph wolph closed this as completed in 2fa2be2 Feb 11, 2023
wolph added a commit that referenced this issue Feb 11, 2023
Made sure list filters and other options are never duplicated. Fixes #14 v2.6.0

# -----BEGIN PGP SIGNATURE-----
#
# iQIzBAABCgAdFiEEFJMl/RWQTpxOuJ6V6BRE6c4faV0FAmPoHMoACgkQ6BRE6c4f
# aV2vaRAAk6daQXxf/LRxrrZJkNlEAgTccF90gQPqXrp2bgm2wJ8h7lO2k/sQSojq
# izCGkFlVexLlVE0evk+s6tPhl7kHCRLuzy16jgtHzsko8frpQBSVetg6MHfhdLWH
# pG4UZDcOukV+ytQmMxAjwWAhPI5sCu/xcK5ckppWLKHbO0ZulV/NIPDNAg8HNFnL
# c9+WMBB9TxnZePZ4V1WUBcRiX3sEwongxiK65lV1NJuw2jUPSJU7mLLSThyuDBti
# 6OpwbOCyBA+3wUpX26XM5cuzKoiwRQoEekXNdTot3/SyOmNKIzVZvNO5CRxed6Kr
# xbdlF/xJpJ9w1wLyENWCkI4NBu40IyoDVQWUiDTtDyKmur/Ie1ZAcnD3TLaGRxsm
# S3QaMSJljdxqBShzBL7zVU10L4Og+ZJpIqWxsvxcf+QmxjJuASC8pGyGTPugxXZJ
# RyDqP6R9IDyi4dDjXcXblhUfayVT7hFS4uc8bntyL03EB1zjV/mjNkMmdjhjRNAI
# w1gB3ebJvB9QW2z2jbD+wOUCmgOG6Dh5HvXXBOxKCyZ6oU2UEG0uw+uRNaDYQ/iG
# Nu0Yhc3CiEK9mV9IIUwRM8zZNJClMg3Rpp9NwgQ7XDxmAkhAV5qoqskd5pBalMes
# 1rsMPMclsbC6dYklfw4gmc/C0oksOx6Bkkjf0WhEmxHEc2ftSCg=
# =GIbS
# -----END PGP SIGNATURE-----
# gpg: Signature made Sat Feb 11 23:55:06 2023 CET
# gpg:                using RSA key 149325FD15904E9C4EB89E95E81444E9CE1F695D
# gpg: Good signature from "Rick van Hattem <[email protected]>" [ultimate]
# gpg:                 aka "[jpeg image of size 9662]" [ultimate]
@wolph
Copy link
Owner

wolph commented Feb 14, 2023

I've created a new release that fixes this issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants