-
Notifications
You must be signed in to change notification settings - Fork 1
Mk/conditional fields #2
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
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Christian Merten <christian@merten.dev>
Co-authored-by: Christian Merten <christian@merten.dev>
|
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: |
|
@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…. |
chrisflav
left a comment
There was a problem hiding this 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!
| if custom_included: | ||
| # custom included fields take precedence over exclude | ||
| return custom_included |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| 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", []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| 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.
| expected_permissions = ( | ||
| 'add_global', 'change_global', 'view_global', 'delete_global', 'list_global', 'view', | ||
| "add_global", | ||
| "change_global", | ||
| "view_global", | ||
| "delete_global", | ||
| "list_global", | ||
| "view", |
There was a problem hiding this comment.
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?
| Customization Guide | ||
| ================= | ||
|
|
||
| This guide explains how to customize the Kompass application using configuration files and templates. | ||
|
|
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.