Pre-select plan when adding update from toolbar
This commit is contained in:
parent
e6fec572a8
commit
14d7f2b249
2 changed files with 12 additions and 0 deletions
|
|
@ -33,6 +33,7 @@ class GovPlanToolbar(CMSToolbar):
|
||||||
"admin:froide_govplan_governmentplanupdate_add",
|
"admin:froide_govplan_governmentplanupdate_add",
|
||||||
current_app="govplanadmin",
|
current_app="govplanadmin",
|
||||||
)
|
)
|
||||||
|
url = "{}?plan={}".format(url, govplan.id)
|
||||||
menu.add_modal_item(_("Add update"), url=url)
|
menu.add_modal_item(_("Add update"), url=url)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
{% extends "admin/change_form.html" %}
|
||||||
|
|
||||||
|
{% block after_field_sets %}
|
||||||
|
{% if not original.pk %}
|
||||||
|
<script>
|
||||||
|
(function(){
|
||||||
|
document.getElementById('id_plan').value = new URLSearchParams(window.location.search).get("plan") || ""
|
||||||
|
}())
|
||||||
|
</script>
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue