Is your feature request related to a problem? Please describe.
We need a way to append a querystring or fragment to a notification target URL, especially for generic_message notifications, without allowing callers to override the full URL.
Describe the solution you'd like
Add a target_url_suffix argument to notify.send, for example:
notify.send(
type="generic_message",
sender=obj,
target=obj,
target_url_suffix="?status=pending",
)
The suffix should be appended in the notification model when resolving target_url. It should also support fragments, for example target_url_suffix="#pending".
Invalid values should raise ValueError when passed to notify.send. Valid suffixes should start with ?, &, or #.
Describe alternatives you've considered
Using the existing notification type target_link mechanism works for dedicated notification types, but it is type-level and not suitable for per-notification generic_message usage.
Allowing a full URL override is too broad for this use case.
Additional context
The goal is to keep the feature narrow and model-centered: generate the existing target URL as usual, then append the validated suffix.
Originally needed in openwisp/openwisp-firmware-upgrader#436.
Is your feature request related to a problem? Please describe.
We need a way to append a querystring or fragment to a notification target URL, especially for
generic_messagenotifications, without allowing callers to override the full URL.Describe the solution you'd like
Add a
target_url_suffixargument tonotify.send, for example:The suffix should be appended in the notification model when resolving
target_url. It should also support fragments, for exampletarget_url_suffix="#pending".Invalid values should raise
ValueErrorwhen passed tonotify.send. Valid suffixes should start with?,&, or#.Describe alternatives you've considered
Using the existing notification type
target_linkmechanism works for dedicated notification types, but it is type-level and not suitable for per-notificationgeneric_messageusage.Allowing a full URL override is too broad for this use case.
Additional context
The goal is to keep the feature narrow and model-centered: generate the existing target URL as usual, then append the validated suffix.
Originally needed in openwisp/openwisp-firmware-upgrader#436.