Skip to content

Conversation

@mariusrklein
Copy link
Collaborator

@mariusrklein mariusrklein commented Oct 11, 2025

  • funktioniert für fieldsets

  • design-Entscheidung: fields und exclude ist beides möglich, fields überschreibt aber exclude wenn beides vorhanden. fields ist absolut (angegebene custom fields werden angezeigt, egal was in der app angegeben ist, außer im fieldset, da aktuell keine ganze Struktur/Gruppierung angegeben werden kann), exclude ist additiv (zu existierendem exclude in der app)

  • tests

  • doku im development manual

  • implementiert im CommenAdminMixin, daher aktuell nicht auf alle Admins anwendbar —> implementiert als eines FieldCustomizationMixin, was alle Admins einfach erben können.

@mariusrklein
Copy link
Collaborator Author

I checked out which models don't inherit CommonAdminMixin. Those could not be customized. Where useful (in my opinion), i added an inheritance manually (marked with OK) here:
finance.TransactionOnSubmittedStatementInline OK
finance.TransactionAdmin OK
finance.BillAdmin OK
finance.LedgerAdmin
logindata.UserInline
logindata.LoginDatumAdmin
ludwigsburgalpin.TerminAdmin
mailer.EmailAddressAdmin OK
material.MaterialCategoryAdmin
material.OwnershipInline
material.MaterialAdmin
members.TrainingCategoryAdmin
members.ActivityCategoryAdmin
members.MemberNoteListAdmin
members.RegistrationPasswordInline
members.KlettertreffAttendeeInline
startpage.LinkAdmin
startpage.MemberOnPostInline
startpage.ImageInline

@mariusrklein
Copy link
Collaborator Author

@chrisflav what do you think?

currently we don't adapt list views etc. however, this shouldn't be a regular thing anyway as columns that appear in the list view should be quite important….

Copy link
Owner

@chrisflav chrisflav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this looks quite nice. Thanks!

Comment on lines +160 to +162
if custom_included:
# custom included fields take precedence over exclude
return custom_included
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if custom_included:
# custom included fields take precedence over exclude
return custom_included
if not custom_included is None:
# custom included fields take precedence over exclude
return custom_included

Otherwise, setting fields = [] will be ignored. Similarly elsewhere.

# For any other type of field, just call its formfield() method.
return db_field.formfield(**kwargs)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


def get_included_fields(self):
"""if model has an entire fieldset in settings, return them as list"""
return settings.CUSTOM_MODEL_FIELDS.get(self.field_key, {}).get("fields", [])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return settings.CUSTOM_MODEL_FIELDS.get(self.field_key, {}).get("fields", [])
return settings.CUSTOM_MODEL_FIELDS.get(self.field_key, {}).get("fields", None)

Required for the change below. The same should be done for the exclude variant.

Comment on lines 65 to +71
expected_permissions = (
'add_global', 'change_global', 'view_global', 'delete_global', 'list_global', 'view',
"add_global",
"change_global",
"view_global",
"delete_global",
"list_global",
"view",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look like you run some formatting tool. Could you please revert the formatting changes for now so we can do all the formatting changes in one go?

Comment on lines +1 to +5
Customization Guide
=================

This guide explains how to customize the Kompass application using configuration files and templates.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add this guide to the table of contents for the developer manual?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: the documentation got deployed at https://chrisflav.github.io/kompass/2/merge/development_manual/customization. Unfortunately, I have no idea why it is deployed at this strange url 2/merge instead of MK/conditional_fields.

@kuihlein kuihlein mentioned this pull request Dec 6, 2025
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

Successfully merging this pull request may close these issues.

3 participants