Skip to content

Commit

Permalink
refactor: Convert custom form template to bootstrap (#6763)
Browse files Browse the repository at this point in the history
* refactor: Convert custom form template to bootstrap

* refactor: Match form fields to old version
  • Loading branch information
pselkirk authored Dec 14, 2023
1 parent e9d44d4 commit cfaf84f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 23 deletions.
10 changes: 8 additions & 2 deletions ietf/meeting/forms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright The IETF Trust 2016-2020, All Rights Reserved
# Copyright The IETF Trust 2016-2023, All Rights Reserved
# -*- coding: utf-8 -*-


Expand Down Expand Up @@ -360,7 +360,13 @@ def save_agenda(self):
class InterimAnnounceForm(forms.ModelForm):
class Meta:
model = Message
fields = ('to', 'frm', 'cc', 'bcc', 'reply_to', 'subject', 'body')
fields = ('to', 'cc', 'frm', 'subject', 'body')

def __init__(self, *args, **kwargs):
super(InterimAnnounceForm, self).__init__(*args, **kwargs)
self.fields['frm'].label='From'
self.fields['frm'].widget.attrs['readonly'] = True
self.fields['to'].widget.attrs['readonly'] = True

def save(self, *args, **kwargs):
user = kwargs.pop('user')
Expand Down
23 changes: 2 additions & 21 deletions ietf/templates/meeting/interim_send_announcement.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "base.html" %}
{# Copyright The IETF Trust 2015, All Rights Reserved #}
{# Copyright The IETF Trust 2015-2023, All Rights Reserved #}
{% load origin %}
{% load static django_bootstrap5 widget_tweaks %}
{% block title %}Announce Interim Meeting{% endblock %}
Expand All @@ -11,26 +11,7 @@
<h1>Announce Interim Meeting</h1>
<form method="post" class="my-3">
{% csrf_token %}
<div class="row mb-3">
<label for="{{ form.to.id_for_label }}" class="col-md-2 fw-bold col-form-label">To</label>
<div class="col-md-10">{% render_field form.to class="form-control" readonly="readonly" %}</div>
</div>
<div class="row mb-3">
<label for="{{ form.cc.id_for_label }}" class="col-md-2 fw-bold col-form-label">Cc</label>
<div class="col-md-10">{% render_field form.cc class="form-control" %}</div>
</div>
<div class="row mb-3">
<label for="{{ form.frm.id_for_label }}" class="col-md-2 fw-bold col-form-label">From</label>
<div class="col-md-10">{% render_field form.frm class="form-control" readonly="readonly" %}</div>
</div>
<div class="row mb-3">
<label for="{{ form.subject.id_for_label }}" class="col-md-2 fw-bold col-form-label">Subject</label>
<div class="col-md-10">{% render_field form.subject class="form-control" %}</div>
</div>
<div class="row mb-3">
<label for="{{ form.body.id_for_label }}" class="col-md-2 fw-bold col-form-label">Body</label>
<div class="col-md-10">{% render_field form.body class="form-control" %}</div>
</div>
{% bootstrap_form form layout="horizontal" %}
<button class="btn btn-primary" type="submit" name="send">Send</button>
<a class="btn btn-secondary float-end"
href="{% url 'ietf.meeting.views.interim_request_details' number=meeting.number %}">
Expand Down

0 comments on commit cfaf84f

Please sign in to comment.