|
11 | 11 | from django.forms.util import ErrorList |
12 | 12 | from django.contrib.auth.decorators import login_required |
13 | 13 | from django.template.defaultfilters import pluralize |
| 14 | +from django.contrib import messages |
14 | 15 |
|
15 | 16 | from ietf.doc.models import ( Document, DocAlias, DocRelationshipName, RelatedDocument, State, |
16 | 17 | StateType, DocEvent, ConsensusDocEvent, TelechatDocEvent, WriteupDocEvent, IESG_SUBSTATE_TAGS, |
@@ -953,27 +954,32 @@ def edit_shepherd(request, name): |
953 | 954 | if request.method == 'POST': |
954 | 955 | form = ShepherdForm(request.POST) |
955 | 956 | if form.is_valid(): |
956 | | - save_document_in_history(doc) |
957 | 957 |
|
958 | 958 | if form.cleaned_data['shepherd'] != doc.shepherd: |
| 959 | + |
| 960 | + save_document_in_history(doc) |
| 961 | + |
959 | 962 | doc.shepherd = form.cleaned_data['shepherd'] |
960 | 963 | doc.save() |
961 | | - |
| 964 | + |
962 | 965 | c = DocEvent(type="added_comment", doc=doc, by=request.user.person) |
963 | 966 | c.desc = "Document shepherd changed to "+ (doc.shepherd.person.name if doc.shepherd else "(None)") |
964 | 967 | c.save() |
| 968 | + |
| 969 | + if doc.shepherd.formatted_email() not in doc.notify: |
| 970 | + login = request.user.person |
| 971 | + addrs = doc.notify |
| 972 | + if addrs: |
| 973 | + addrs += ', ' |
| 974 | + addrs += doc.shepherd.formatted_email() |
| 975 | + make_notify_changed_event(request, doc, login, addrs, c.time) |
| 976 | + doc.notify = addrs |
| 977 | + |
| 978 | + doc.time = c.time |
| 979 | + doc.save() |
965 | 980 |
|
966 | | - if doc.shepherd.formatted_email() not in doc.notify: |
967 | | - login = request.user.person |
968 | | - addrs = doc.notify |
969 | | - if addrs: |
970 | | - addrs += ', ' |
971 | | - addrs += doc.shepherd.formatted_email() |
972 | | - make_notify_changed_event(request, doc, login, addrs, c.time) |
973 | | - doc.notify = addrs |
974 | | - |
975 | | - doc.time = c.time |
976 | | - doc.save() |
| 981 | + else: |
| 982 | + messages.info(request,"The selected shepherd was already assigned - no changes have been made.") |
977 | 983 |
|
978 | 984 | return redirect('doc_view', name=doc.name) |
979 | 985 |
|
|
0 commit comments