From f8b107ef5a25f6ea9d82e42b69b83f4036cd979d Mon Sep 17 00:00:00 2001 From: Ryan Cross <rcross@amsl.com> Date: Fri, 10 Aug 2018 05:13:43 +0000 Subject: [PATCH] Remove WG milestone management from secretariat groups app. Commit ready for merge. - Legacy-Id: 15423 --- ietf/secr/groups/forms.py | 25 +--------- ietf/secr/groups/urls.py | 2 - ietf/secr/groups/views.py | 57 +--------------------- ietf/secr/templates/groups/edit_gm.html | 64 ------------------------- ietf/secr/templates/groups/view.html | 1 - ietf/secr/templates/groups/view_gm.html | 47 ------------------ 6 files changed, 3 insertions(+), 193 deletions(-) delete mode 100644 ietf/secr/templates/groups/edit_gm.html delete mode 100644 ietf/secr/templates/groups/view_gm.html diff --git a/ietf/secr/groups/forms.py b/ietf/secr/groups/forms.py index c002b3b30..af4dfd63e 100644 --- a/ietf/secr/groups/forms.py +++ b/ietf/secr/groups/forms.py @@ -3,7 +3,7 @@ import re from django import forms from django.db.models import Count -from ietf.group.models import Group, GroupMilestone, Role +from ietf.group.models import Group, Role from ietf.name.models import GroupStateName, GroupTypeName, RoleName from ietf.person.models import Person, Email from ietf.liaisons.models import LiaisonStatementGroupContacts @@ -47,29 +47,6 @@ def get_parent_group_choices(): class DescriptionForm (forms.Form): description = forms.CharField(widget=forms.Textarea(attrs={'rows':'20'}),required=True, strip=False) -class GroupMilestoneForm(forms.ModelForm): - class Meta: - model = GroupMilestone - exclude = ('done',) - - # use this method to set attrs which keeps other meta info from model. - def __init__(self, *args, **kwargs): - super(GroupMilestoneForm, self).__init__(*args, **kwargs) - self.fields['desc'].widget=forms.TextInput(attrs={'size':'60'}) - self.fields['expected_due_date'].widget.attrs['size'] = 10 - self.fields['done_date'].widget.attrs['size'] = 10 - - # override save. set done=True if done_date set - def save(self, force_insert=False, force_update=False, commit=True): - m = super(GroupMilestoneForm, self).save(commit=False) - if 'done_date' in self.changed_data: - if self.cleaned_data.get('done_date',''): - m.done = True - else: - m.done = False - if commit: - m.save() - return m class GroupModelForm(forms.ModelForm): type = forms.ModelChoiceField(queryset=GroupTypeName.objects.all(),empty_label=None) diff --git a/ietf/secr/groups/urls.py b/ietf/secr/groups/urls.py index 8dcb5d46b..f19a3efc2 100644 --- a/ietf/secr/groups/urls.py +++ b/ietf/secr/groups/urls.py @@ -13,7 +13,5 @@ urlpatterns = [ url(r'^%(acronym)s/delete/(?P<id>\d{1,6})/$' % settings.URL_REGEXPS, views.delete_role), url(r'^%(acronym)s/charter/$' % settings.URL_REGEXPS, views.charter), url(r'^%(acronym)s/edit/$' % settings.URL_REGEXPS, views.edit), - url(r'^%(acronym)s/gm/$' % settings.URL_REGEXPS, views.view_gm), - url(r'^%(acronym)s/gm/edit/$' % settings.URL_REGEXPS, views.edit_gm), url(r'^%(acronym)s/people/$' % settings.URL_REGEXPS, views.people), ] diff --git a/ietf/secr/groups/views.py b/ietf/secr/groups/views.py index 6c0d46cb3..ad3ac8ff7 100644 --- a/ietf/secr/groups/views.py +++ b/ietf/secr/groups/views.py @@ -3,11 +3,11 @@ from django.conf import settings from django.forms.models import inlineformset_factory from django.shortcuts import render, get_object_or_404, redirect -from ietf.group.models import Group, GroupMilestone, ChangeStateGroupEvent, GroupEvent, GroupURL, Role +from ietf.group.models import Group, ChangeStateGroupEvent, GroupEvent, GroupURL, Role from ietf.group.utils import save_group_in_history, get_charter_text, setup_default_community_list_for_group from ietf.ietfauth.utils import role_required from ietf.person.models import Person -from ietf.secr.groups.forms import GroupModelForm, GroupMilestoneForm, RoleForm, SearchForm +from ietf.secr.groups.forms import GroupModelForm, RoleForm, SearchForm from ietf.secr.areas.forms import AWPForm from ietf.secr.utils.meeting import get_current_meeting @@ -278,41 +278,6 @@ def edit(request, acronym): 'form': form}, ) -@role_required('Secretariat') -def edit_gm(request, acronym): - """ - Edit IETF Group Goal and Milestone details - - **Templates:** - - * ``groups/edit_gm.html`` - - **Template Variables:** - - * group, formset - - """ - - group = get_object_or_404(Group, acronym=acronym) - GMFormset = inlineformset_factory(Group, GroupMilestone, form=GroupMilestoneForm, can_delete=True, extra=5) - - if request.method == 'POST': - button_text = request.POST.get('submit', '') - if button_text == 'Cancel': - return redirect('ietf.secr.groups.views.view', acronym=acronym) - - formset = GMFormset(request.POST, instance=group, prefix='goalmilestone') - if formset.is_valid(): - formset.save() - messages.success(request, 'The Goals Milestones were changed successfully') - return redirect('ietf.secr.groups.views.view', acronym=acronym) - else: - formset = GMFormset(instance=group, prefix='goalmilestone') - - return render(request, 'groups/edit_gm.html', { - 'group': group, - 'formset': formset}, - ) @role_required('Secretariat') def people(request, acronym): @@ -460,21 +425,3 @@ def view(request, acronym): return render(request, 'groups/view.html', { 'group': group } ) -@role_required('Secretariat') -def view_gm(request, acronym): - """ - View IETF Group Goals and Milestones details - - **Templates:** - - * ``groups/view_gm.html`` - - **Template Variables:** - - * group - - """ - - group = get_object_or_404(Group, acronym=acronym) - - return render(request, 'groups/view_gm.html', { 'group': group } ) diff --git a/ietf/secr/templates/groups/edit_gm.html b/ietf/secr/templates/groups/edit_gm.html deleted file mode 100644 index 0eee1895b..000000000 --- a/ietf/secr/templates/groups/edit_gm.html +++ /dev/null @@ -1,64 +0,0 @@ -{% extends "base_site.html" %} -{% load staticfiles %} - -{% block title %}Groups - Edit{% endblock %} - -{% block extrahead %}{{ block.super }} - <script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script> - <script type="text/javascript" src="{% static 'secr/js/dynamic_inlines.js' %}"></script> -{% endblock %} - -{% block breadcrumbs %}{{ block.super }} - » <a href="../../../">Groups</a> - » <a href="../../">{{ group.acronym }}</a> - » <a href="../">Goals and Milestones</a> - » Edit -{% endblock %} - -{% block content %} - -<div class="module group-container"> - <form id="edit-gm" enctype="multipart/form-data" action="" method="post">{% csrf_token %} - -<div class="inline-group"> - <div class="tabular inline-related"> - <h2>Goals and Milestones</h2> - {{ formset.management_form }} - {{ formset.non_form_errors }} - <table class="full-width"> - <thead><tr> - {% for field in formset.forms.0.visible_fields %} - <th>{{ field.label|capfirst }}</th> - {% endfor %} - </tr></thead> - - <tbody> - {% for form in formset.forms %} - {% if form.non_field_errors %} - <tr><td colspan="3">{{ form.non_field_errors }}</td></tr> - {% endif %} - <tr class="{% cycle 'row1' 'row2' %}"> - - {% for hidden in form.hidden_fields %} - {{ hidden }} - {% endfor %} - {% for field in form.visible_fields %} - <td> - {{ field.errors }} - {{ field }} - </td> - {% endfor %} - </tr> - {% endfor %} - </tbody> - </table> -</div> <!-- tabular inline-related --> -</div> <!-- inline-group --> - - {% include "includes/buttons_save_cancel.html" %} - - </form> -</div> <!-- module --> - - -{% endblock %} diff --git a/ietf/secr/templates/groups/view.html b/ietf/secr/templates/groups/view.html index 380062307..f64eb4ea3 100644 --- a/ietf/secr/templates/groups/view.html +++ b/ietf/secr/templates/groups/view.html @@ -106,7 +106,6 @@ <ul> <li><button onclick="window.location='edit/'">Edit</button></li> <li><button onclick="window.location='people/'">People</button></li> - <li><button onclick="window.location='gm/'">G + M</button></li> {% comment %} <li><button onclick="window.location='{% url "sec.ids.views.search" id=group.group_acronym.acronym_id %}'">Drafts</button></li> <li><button onclick="window.location='{% url "sec.rfcs.views.search" id=group.group_acronym.acronym_id %}'">RFCs</button></li> diff --git a/ietf/secr/templates/groups/view_gm.html b/ietf/secr/templates/groups/view_gm.html deleted file mode 100644 index 12a019739..000000000 --- a/ietf/secr/templates/groups/view_gm.html +++ /dev/null @@ -1,47 +0,0 @@ -{% extends "base_site.html" %} -{% load staticfiles %} - -{% block title %}Groups - View G+M{% endblock %} - -{% block extrahead %}{{ block.super }} - <script type="text/javascript" src="{% static 'secr/js/utils.js' %}"></script> -{% endblock %} - -{% block breadcrumbs %}{{ block.super }} - » <a href="../../">Groups</a> - » <a href="../">{{ group.acronym }}</a> - » Goals and Milestones -{% endblock %} - -{% block content %} - -<div class="module group-container"> - <h2>Groups - View Goals and Milestones</h2> - <table class="full-width"> - <thead> - <tr> - <th>Description</th> - <th>Expected Due Date</th> - <th>Done Date</th> - </tr> - </thead> - <tbody> - {% for gm in group.groupmilestone_set.all %} - <tr class="{% cycle 'row1' 'row2' %}"> - <td>{{ gm.desc }}</td> - <td>{{ gm.expected_due_date|date:"Y-m-d" }}</td> - <td>{{ gm.done_date|date:"Y-m-d" }}</td> - </tr> - {% endfor %} - </tbody> - </table> - - <div class="button-group"> - <ul> - <!-- <li><button onclick="window.location='../../'">Back</button></li> --> - <li><button onclick="window.location='edit/'">Edit</button></li> - </ul> - </div> <!-- button-group --> -</div> <!-- module --> - -{% endblock %}