cuducos / django-public-admin

🔓 A public and read-only version of the Django Admin
MIT License
37 stars 5 forks source link

`models` does not affect the public app #15

Closed anapaulagomes closed 3 years ago

anapaulagomes commented 4 years ago

When having models=() and registering the models itself on public_admin, it works. All registered models are shown (https://github.com/DadosAbertosDeFeira/maria-quiteria/pull/114/). Is it a bug or a feature? :sweat_smile:

public_app = PublicApp("datasets", models=())
public_admin = MariaQuiteriaPublicAdminSite(public_apps=public_app)
models_and_admins = [
    (CityCouncilAgenda, CityCouncilAgendaAdmin),
    (CityCouncilAttendanceList, CityCouncilAttendanceListAdmin),
    (CityCouncilExpense, CityCouncilExpenseAdmin),
    (CityCouncilMinute, CityCouncilMinuteAdmin),
    (Gazette, GazetteAdmin),
    (CityHallBid, CityHallBidAdmin),
]

for model, admin in models_and_admins:
    public_admin.register(model, admin)
cuducos commented 4 years ago

Definitively a bug :bug:!

Also, a reflection of the alpha status of this package. As far as I remember, the models declared in the PublicApp are mostly used to:

I have to dedicate some time to replicate this bug and understand a few things before thinking about a possible solution, but I think something to explore is to have our own register method that does this verification.