-
Notifications
You must be signed in to change notification settings - Fork 38
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
Extension user field addition #4396
base: main
Are you sure you want to change the base?
Conversation
This is pulled from https://github.com/nitely/django-hooks with everything except the template hooks removed.
This gives any extension the ability to add css and javascript to every page in hypha.
Allows extensions that want to add new fields to users to have those fields present in the wagtail admin.
@frankduncan The template hooks feature are now merged in. Can you make this PR only add the hooks in the templates, thanks! Did you have plans to add tests to make sure the various hooks still exist? |
@@ -8,6 +9,8 @@ | |||
{% include "wagtailadmin/shared/field_as_li.html" with field=form.email %} | |||
{% include "wagtailadmin/shared/field_as_li.html" with field=form.full_name %} | |||
|
|||
{% hook 'wagtail_user_edit' %} |
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.
Shouldn't this be called wagtail_user_create
, thoughts? I believe the context for edit and create will be different.
For a specific plugin, if it's needs to the same thing at the both the places, it can implement both the hooks, but those plugins that need to insert different code at different places, might not get an option to do so.
Also, this could introduce bug due to it's non-explicit nature of the hook name.
My 2 cents!
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.
That makes sense. I'll update when I make the PR.
@frjo Yeah, I'll add tests and clean up this branch. Thanks! |
Adds template hooks in necessary places to allow adding fields to the User object. The first commit is an example replacement for the
{% include "includes/head_end.html" %}
inhypha/templates/base.html
, with an improvement that if you have multiple extensions that want to add things to the<head>
of every hypha page, they won't overwrite each other and can remain uncoupled.This also adds in hooks into the user create/update forms in wagtail, as those aren't built on the
WAGTAIL_CUSTOM_FIELDS
like the main profile update page is.This depends on #4395