]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
views: Clean up patch-list page
authorRaxel Gutierrez <raxelgutierrez09@gmail.com>
Mon, 23 Aug 2021 18:28:29 +0000 (18:28 +0000)
committerStephen Finucane <stephen@that.guru>
Fri, 1 Nov 2024 15:47:20 +0000 (15:47 +0000)
Add ids to table cells, and rename selectors using hyphen delimited
strings to clean up and improve readability of patch-list.html. Also,
create a partial template errors.html for errors that render with form
submission.These changes make the code healthier, ready for change, and
overall more readable.

No user-visible change should be noticed.

Signed-off-by: Raxel Gutierrez <raxel@google.com>
Signed-off-by: Stephen Finucane <stephen@that.guru>
[stephenfin: Addressed merge conflicts and renamed some Python variables
             in snake_case also]

htdocs/css/style.css
htdocs/js/bundle.js
patchwork/templates/patchwork/partials/patch-list.html
patchwork/templates/patchwork/submission.html
patchwork/tests/views/test_bundles.py
patchwork/tests/views/test_patch.py
patchwork/views/__init__.py
patchwork/views/bundle.py
patchwork/views/patch.py

index c4025c0505d62ced83062ae29ed7a2402a3c3514..57c52e059364d45acf84090fea5b58f5eeb8678b 100644 (file)
@@ -162,25 +162,25 @@ table.pw-list > thead {
     background-color: white;
 }
 
-a.colinactive, a.colactive {
+a.col-inactive, a.col-active {
     color: black;
     text-decoration: none;
 }
 
-a.colinactive:hover {
+a.col-inactive:hover {
     color: red;
 }
 
 div.filters {
 }
 
-div.patchforms {
+div.patch-forms {
     margin-top: 1em;
 }
 
 /* list order manipulation */
 
-table.patchlist tr.draghover {
+table.patch-list tr.draghover {
     background: #e8e8e8 !important;
 }
 
@@ -256,7 +256,7 @@ table.patch-meta tr th, table.patch-meta tr td {
 }
 
 /* checks forms */
-/* TODO(stephenfin): Merge this with 'div.patchform' rules */
+/* TODO(stephenfin): Merge this with 'div.patch-form' rules */
 .checks {
     border: 1px solid gray;
     margin: 0.5em 1em;
@@ -434,7 +434,7 @@ table.bundlelist td
 }
 
 /* forms that appear for a patch */
-div.patchform {
+div.patch-form {
     border: thin solid #080808;
     padding-left: 0.6em;
     padding-right: 0.6em;
@@ -442,7 +442,7 @@ div.patchform {
     margin: 0.5em 5em 0.5em 10px;
 }
 
-div.patchform h3 {
+div.patch-form h3 {
     margin-top: 0em;
     margin-left: -0.6em;
     margin-right: -0.6em;
@@ -452,7 +452,7 @@ div.patchform h3 {
     font-size: 100%;
 }
 
-div.patchform ul {
+div.patch-form ul {
     list-style-type: none;
     padding-left: 0.2em;
     margin-top: 0em;
index c969d0be4145183451cadff991ca68b1d79d5fc5..2a721d0ddf0552f4c5d4a2e57838b0990a0ab77b 100644 (file)
@@ -6,8 +6,8 @@ function order_button_click(node)
 {
     var rows, form;
 
-    form = $("#reorderform");
-    rows = $("#patchlist").get(0).tBodies[0].rows;
+    form = $("#reorder-form");
+    rows = $("#patch-list").get(0).tBodies[0].rows;
 
     if (rows.length < 1)
         return;
@@ -35,18 +35,18 @@ function order_button_click(node)
         $("#reorder\\-cancel").css("display", "inline");
 
         /* show help text */
-        $("#reorderhelp").text('Drag & drop rows to reorder');
+        $("#reorder-help").text('Drag & drop rows to reorder');
 
         /* enable drag & drop on the patches list */
-        $("#patchlist").tableDnD({
+        $("#patch-list").tableDnD({
             onDragClass: 'dragging',
             onDragStart: function() { dragging = true; },
             onDrop: function() { dragging = false; }
         });
 
         /* replace zebra striping with hover */
-        $("#patchlist tbody tr").css("background", "inherit");
-        $("#patchlist tbody tr").hover(drag_hover_in, drag_hover_out);
+        $("#patch-list tbody tr").css("background", "inherit");
+        $("#patch-list tbody tr").hover(drag_hover_in, drag_hover_out);
     }
 
     editing_order = !editing_order;
index efefce912533825268e5a9ab0139d00d49eabc6c..48b81f3d5cbd460c718318c07f2a431363cc1153 100644 (file)
@@ -8,14 +8,14 @@
 {% include "patchwork/partials/pagination.html" %}
 
 {% if order.editable %}
-<table class="patchlist">
+<table class="patch-list">
   <tr>
-    <td class="patchlistreorder">
-      <form method="post" id="reorderform">
+    <td class="patch-list-reorder">
+      <form method="post" id="reorder-form">
         {% csrf_token %}
-        <input type="hidden" name="form" value="reorderform"/>
+        <input type="hidden" name="form" value="reorder-form"/>
         <input type="hidden" name="order_start" value="0"/>
-        <span id="reorderhelp"></span>
+        <span id="reorder-help"></span>
         <input id="reorder-cancel" type="button" value="Cancel" onClick="order_cancel_click(this)"/>
         <input id="reorder-change" type="button" value="Change order" onClick="order_button_click(this)"/>
       </form>
@@ -26,7 +26,7 @@
 
 {% if page.paginator.long_page and user.is_authenticated %}
 <div class="floaty">
-  <a title="jump to form" href="#patchforms">
+  <a title="jump to form" href="#patch-forms">
     <span style="font-size: 120%">&#9662;</span>
   </a>
 </div>
 
 <script type="text/javascript">
 $(document).ready(function() {
-    $('#patchlist').stickyTableHeaders();
+    $('#patch-list').stickyTableHeaders();
 
-    $('#patchlist').checkboxes('range', true);
+    $('#patch-list').checkboxes('range', true);
 
     $('#check-all').change(function(e) {
         if(this.checked) {
-            $('#patchlist > tbody').checkboxes('check');
+            $('#patch-list > tbody').checkboxes('check');
         } else {
-            $('#patchlist > tbody').checkboxes('uncheck');
+            $('#patch-list > tbody').checkboxes('uncheck');
         }
         e.preventDefault();
     });
@@ -51,9 +51,9 @@ $(document).ready(function() {
 
 <form method="post">
   {% csrf_token %}
-  <input type="hidden" name="form" value="patchlistform"/>
+  <input type="hidden" name="form" value="patch-list-form"/>
   <input type="hidden" name="project" value="{{project.id}}"/>
-  <table id="patchlist" class="table table-hover table-extra-condensed table-striped pw-list" data-toggle="checkboxes" data-range="true">
+  <table id="patch-list" class="table table-hover table-extra-condensed table-striped pw-list" data-toggle="checkboxes" data-range="true">
     <thead>
       <tr>
 {% if user.is_authenticated %}
@@ -71,22 +71,22 @@ $(document).ready(function() {
         <th>
 {% if not order.editable %}
 {% if order.name == "name" %}
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
             <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
           </a>
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
            Patch
           </a>
 {% else %}
-          <a class="colinactive" href="{% listurl order="name" %}">Patch</a>
+          <a class="col-inactive" href="{% listurl order="name" %}">Patch</a>
 {% endif %}
 {% else %}
-          <span class="colinactive">Patch</span>
+          <span class="col-inactive">Patch</span>
 {% endif %}
         </th>
 
         <th>
-          <span class="colinactive">Series</span>
+          <span class="col-inactive">Series</span>
         </th>
 
         <th>
@@ -100,70 +100,70 @@ $(document).ready(function() {
         <th>
 {% if not order.editable %}
 {% if order.name == "date" %}
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
             <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
           </a>
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
             Date
           </a>
 {% else %}
-          <a class="colinactive" href="{% listurl order="date" %}">Date</a>
+          <a class="col-inactive" href="{% listurl order="date" %}">Date</a>
 {% endif %}
 {% else %}
-          <span class="colinactive">Date</span>
+          <span class="col-inactive">Date</span>
 {% endif %}
         </th>
 
         <th>
 {% if not order.editable %}
 {% if order.name == "submitter" %}
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
             <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
           </a>
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
             Submitter
           </a>
 {% else %}
-          <a class="colinactive" href="{% listurl order="submitter" %}">
+          <a class="col-inactive" href="{% listurl order="submitter" %}">
             Submitter
           </a>
 {% endif %}
 {% else %}
-          <span class="colinactive">Submitter</span>
+          <span class="col-inactive">Submitter</span>
 {% endif %}
         </th>
 
         <th>
 {% if not order.editable %}
 {% if order.name == "delegate" %}
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
             <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
           </a>
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
             Delegate
           </a>
 {% else %}
-          <a class="colinactive" href="{% listurl order="delegate" %}">Delegate</a>
+          <a class="col-inactive" href="{% listurl order="delegate" %}">Delegate</a>
 {% endif %}
 {% else %}
-          <span class="colinactive">Delegate</span>
+          <span class="col-inactive">Delegate</span>
 {% endif %}
         </th>
 
         <th>
 {% if not order.editable %}
 {% if order.name == "state" %}
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
             <span class="glyphicon glyphicon-chevron-{{ order.updown }}"></span>
           </a>
-          <a class="colactive" href="{% listurl order=order.reversed_name %}">
+          <a class="col-active" href="{% listurl order=order.reversed_name %}">
             State
           </a>
 {% else %}
-          <a class="colinactive" href="{% listurl order="state" %}">State</a>
+          <a class="col-inactive" href="{% listurl order="state" %}">State</a>
 {% endif %}
 {% else %}
-          <span class="colinactive">State</span>
+          <span class="col-inactive">State</span>
 {% endif %}
         </th>
 
@@ -172,9 +172,9 @@ $(document).ready(function() {
 
     <tbody>
 {% for patch in page.object_list %}
-      <tr id="patch_row:{{patch.id}}">
+      <tr id="patch-row:{{patch.id}}">
 {% if user.is_authenticated %}
-        <td style="text-align: center;">
+        <td id="select-patch:{{patch.id}}" style="text-align: center;">
           <input type="checkbox" name="patch_id:{{patch.id}}"/>
         </td>
 {% endif %}
@@ -185,24 +185,24 @@ $(document).ready(function() {
           </button>
         </td>
 {% endif %}
-        <td>
+        <td id="patch-name:{{patch.id}}">
           <a href="{% url 'patch-detail' project_id=project.linkname msgid=patch.encoded_msgid %}">
             {{ patch.name|default:"[no subject]"|truncatechars:100 }}
           </a>
         </td>
-        <td>
+        <td id="patch-series:{{patch.id}}">
 {% if patch.series %}
           <a href="?series={{patch.series.id}}">
             {{ patch.series|truncatechars:100 }}
           </a>
 {% endif %}
         </td>
-        <td class="text-nowrap">{{ patch|patch_tags }}</td>
-        <td class="text-nowrap">{{ patch|patch_checks }}</td>
-        <td class="text-nowrap">{{ patch.date|date:"Y-m-d" }}</td>
-        <td>{{ patch.submitter|personify:project }}</td>
-        <td>{{ patch.delegate.username }}</td>
-        <td>{{ patch.state }}</td>
+        <td id="patch-tags:{{patch.id}}" class="text-nowrap">{{ patch|patch_tags }}</td>
+        <td id="patch-checks:{{patch.id}}" class="text-nowrap">{{ patch|patch_checks }}</td>
+        <td id="patch-date:{{patch.id}}" class="text-nowrap">{{ patch.date|date:"Y-m-d" }}</td>
+        <td id="patch-submitter:{{patch.id}}">{{ patch.submitter|personify:project }}</td>
+        <td id="patch-delegate:{{patch.id}}">{{ patch.delegate.username }}</td>
+        <td id="patch-state:{{patch.id}}">{{ patch.state }}</td>
        </tr>
 {% empty %}
       <tr>
@@ -215,37 +215,37 @@ $(document).ready(function() {
 {% if page.paginator.count %}
 {% include "patchwork/partials/pagination.html" %}
 
-  <div class="patchforms" id="patchforms">
+  <div class="patch-forms" id="patch-forms">
 
-{% if patchform %}
-     <div class="patchform patchform-properties">
+{% if patch_form %}
+     <div class="patch-form patch-form-properties">
        <h3>Properties</h3>
        <table class="form">
          <tr>
            <th>Change state:</th>
            <td>
-             {{ patchform.state }}
-             {{ patchform.state.errors }}
+             {{ patch_form.state }}
+             {{ patch_form.state.errors }}
            </td>
          </tr>
          <tr>
            <th>Delegate to:</th>
            <td>
-             {{ patchform.delegate }}
-             {{ patchform.delegate.errors }}
+             {{ patch_form.delegate }}
+             {{ patch_form.delegate.errors }}
            </td>
          </tr>
          <tr>
            <th>Archive:</th>
            <td>
-             {{ patchform.archived }}
-             {{ patchform.archived.errors }}
+             {{ patch_form.archived }}
+             {{ patch_form.archived.errors }}
            </td>
          </tr>
          <tr>
            <td></td>
            <td>
-             <input type="submit" name="action" value="{{patchform.action}}"/>
+             <input type="submit" name="action" value="{{patch_form.action}}"/>
            </td>
          </tr>
        </table>
@@ -253,7 +253,7 @@ $(document).ready(function() {
 {% endif %}
 
 {% if user.is_authenticated %}
-    <div class="patchform patchform-bundle">
+    <div class="patch-form patch-form-bundle">
       <h3>Bundling</h3>
       <table class="form">
         <tr>
index e924934f66b43f163cf47e8e25d6b2c13f5c5dcc..aa4e5553dc195c435f7a3b2ea4f8c58295a39f71 100644 (file)
 {% endif %}
 </table>
 
-<div class="patchforms">
-{% if patchform %}
-  <div class="patchform patchform-properties">
+<div class="patch-forms">
+{% if patch_form %}
+  <div class="patch-form patch-form-properties">
     <h3>Patch Properties</h3>
     <form method="post">
       {% csrf_token %}
         <tr>
           <th>Change state:</th>
           <td>
-            {{ patchform.state }}
-            {{ patchform.state.errors }}
+            {{ patch_form.state }}
+            {{ patch_form.state.errors }}
           </td>
         </tr>
         <tr>
           <th>Delegate to:</th>
           <td>
-            {{ patchform.delegate }}
-            {{ patchform.delegate.errors }}
+            {{ patch_form.delegate }}
+            {{ patch_form.delegate.errors }}
           </td>
         </tr>
         <tr>
           <th>Archived:</th>
           <td>
-            {{ patchform.archived }}
-            {{ patchform.archived.errors }}
+            {{ patch_form.archived }}
+            {{ patch_form.archived.errors }}
           </td>
         </tr>
         <tr>
   </div>
 {% endif %}
 
-{% if createbundleform %}
-  <div class="patchform patchform-bundle">
+{% if create_bundle_form %}
+  <div class="patch-form patch-form-bundle">
     <h3>Bundling</h3>
     <table class="form">
       <tr>
         <td>Create bundle:</td>
         <td>
-{% if createbundleform.non_field_errors %}
-          <dd class="errors">{{createbundleform.non_field_errors}}</dd>
+{% if create_bundle_form.non_field_errors %}
+          <dd class="errors">{{create_bundle_form.non_field_errors}}</dd>
 {% endif %}
           <form method="post">
             {% csrf_token %}
             <input type="hidden" name="action" value="createbundle"/>
-{% if createbundleform.name.errors %}
-            <dd class="errors">{{createbundleform.name.errors}}</dd>
+{% if create_bundle_form.name.errors %}
+            <dd class="errors">{{create_bundle_form.name.errors}}</dd>
 {% endif %}
-            {{ createbundleform.name }}
+            {{ create_bundle_form.name }}
             <input value="Create" type="submit"/>
           </form>
         </td>
index 517b4439b4e5b3891665ec15889c456f6631e22f..24ebe6123a994ca3b43751bb1aaa952f91740551 100644 (file)
@@ -170,7 +170,7 @@ class BundleUpdateTest(BundleTestBase):
         self.assertEqual(bundle.public, not self.bundle.public)
 
         # check other forms for errors
-        formname = 'patchform'
+        formname = 'patch_form'
         if formname not in response.context:
             return
         form = response.context[formname]
@@ -368,7 +368,7 @@ class BundleCreateFromListTest(BundleTestBase):
     def test_create_empty_bundle(self):
         newbundlename = 'testbundle-new'
         params = {
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'bundle_name': newbundlename,
             'action': 'Create',
             'project': self.project.id,
@@ -388,7 +388,7 @@ class BundleCreateFromListTest(BundleTestBase):
         patch = self.patches[0]
 
         params = {
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'bundle_name': newbundlename,
             'action': 'Create',
             'project': self.project.id,
@@ -417,7 +417,7 @@ class BundleCreateFromListTest(BundleTestBase):
         n_bundles = Bundle.objects.count()
 
         params = {
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'bundle_name': '',
             'action': 'Create',
             'project': self.project.id,
@@ -443,7 +443,7 @@ class BundleCreateFromListTest(BundleTestBase):
         patch = self.patches[0]
 
         params = {
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'bundle_name': newbundlename,
             'action': 'Create',
             'project': self.project.id,
@@ -532,7 +532,7 @@ class BundleAddFromListTest(BundleTestBase):
     def test_add_to_empty_bundle(self):
         patch = self.patches[0]
         params = {
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'action': 'Add',
             'project': self.project.id,
             'bundle_id': self.bundle.id,
@@ -557,7 +557,7 @@ class BundleAddFromListTest(BundleTestBase):
         self.bundle.append_patch(self.patches[0])
         patch = self.patches[1]
         params = {
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'action': 'Add',
             'project': self.project.id,
             'bundle_id': self.bundle.id,
@@ -592,7 +592,7 @@ class BundleAddFromListTest(BundleTestBase):
         patch = self.patches[0]
 
         params = {
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'action': 'Add',
             'project': self.project.id,
             'bundle_id': self.bundle.id,
@@ -617,7 +617,7 @@ class BundleAddFromListTest(BundleTestBase):
         patch = self.patches[0]
 
         params = {
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'action': 'Add',
             'project': self.project.id,
             'bundle_id': self.bundle.id,
@@ -723,7 +723,7 @@ class BundleInitialOrderTest(BundleTestBase):
 
         # need to define our querystring explicity to enforce ordering
         params = {
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'bundle_name': newbundlename,
             'action': 'Create',
             'project': self.project.id,
@@ -781,7 +781,7 @@ class BundleReorderTest(BundleTestBase):
 
         slice_ids = neworder_ids[start:end]
         params = {
-            'form': 'reorderform',
+            'form': 'reorder-form',
             'order_start': firstpatch.id,
             'neworder': slice_ids,
         }
index b34d4ed1aab11ede09906f9b28e5791847bbf74f..3de558f0b4efb3eef106653bf41ec884d6ca9ab9 100644 (file)
@@ -100,7 +100,7 @@ class PatchListOrderingTest(TestCase):
             create_patch(submitter=person, project=self.project, date=date)
 
     def _extract_patch_ids(self, response):
-        id_re = re.compile(r'<tr id="patch_row:(\d+)"')
+        id_re = re.compile(r'<tr id="patch-row:(\d+)"')
         ids = [
             int(m.group(1)) for m in id_re.finditer(response.content.decode())
         ]
@@ -382,7 +382,7 @@ class PatchViewTest(TestCase):
 
 
 class PatchUpdateTest(TestCase):
-    properties_form_id = 'patchform-properties'
+    properties_form_id = 'patch-form-properties'
 
     def setUp(self):
         self.project = create_project()
@@ -397,7 +397,7 @@ class PatchUpdateTest(TestCase):
         self.base_data = {
             'action': 'Update',
             'project': str(self.project.id),
-            'form': 'patchlistform',
+            'form': 'patch-list-form',
             'archived': '*',
             'delegate': '*',
             'state': '*',
@@ -462,7 +462,7 @@ class PatchUpdateTest(TestCase):
         self.assertEqual(new_states, orig_states)
         if django.VERSION >= (4, 1):
             self.assertFormError(
-                response.context['patchform'],
+                response.context['patch_form'],
                 'state',
                 'Select a valid choice. That choice is not one '
                 'of the available choices.',
@@ -470,7 +470,7 @@ class PatchUpdateTest(TestCase):
         else:
             self.assertFormError(
                 response,
-                'patchform',
+                'patch_form',
                 'state',
                 'Select a valid choice. That choice is not one '
                 'of the available choices.',
index 704ab815393a866e327c962e3727b68b8fa50304..51649488f68ba33a9670e6a258b09dd876cf3d99 100644 (file)
@@ -237,12 +237,12 @@ def generic_list(
         # we only pass the post data to the MultiplePatchForm if that was
         # the actual form submitted
         data_tmp = None
-        if data and data.get('form', '') == 'patchlistform':
+        if data and data.get('form', '') == 'patch-list-form':
             data_tmp = data
 
         properties_form = MultiplePatchForm(project, data=data_tmp)
 
-    if request.method == 'POST' and data.get('form') == 'patchlistform':
+    if request.method == 'POST' and data.get('form') == 'patch-list-form':
         action = data.get('action', '').lower()
 
         # special case: the user may have hit enter in the 'create bundle'
@@ -319,7 +319,7 @@ def generic_list(
     context.update(
         {
             'page': paginator.current_page,
-            'patchform': properties_form,
+            'patch_form': properties_form,
             'project': project,
             'order': order,
         }
index 6b7c264ad4b9b7daa130335bb6e86f3024c26c79..26bf8fec3735f12fcfdd44bf6d2eb06e4fdcbbcd 100644 (file)
@@ -110,7 +110,7 @@ def bundle_detail(request, username, bundlename):
 
         if (
             request.method == 'POST'
-            and request.POST.get('form') == 'reorderform'
+            and request.POST.get('form') == 'reorder-form'
         ):
             order = get_object_or_404(
                 BundlePatch,
index 54cf992c524adacfa1daba0a7d1bec93c3206abe..838391635375d396d92e3d19724f020fb9971537 100644 (file)
@@ -63,12 +63,12 @@ def patch_detail(request, project_id, msgid):
     context = {'project': patch.project}
 
     form = None
-    createbundleform = None
+    create_bundle_form = None
 
     if editable:
         form = PatchForm(instance=patch)
     if request.user.is_authenticated:
-        createbundleform = CreateBundleForm()
+        create_bundle_form = CreateBundleForm()
 
     if request.method == 'POST':
         action = request.POST.get('action', None)
@@ -77,14 +77,14 @@ def patch_detail(request, project_id, msgid):
 
         if action == 'createbundle':
             bundle = Bundle(owner=request.user, project=project)
-            createbundleform = CreateBundleForm(
+            create_bundle_form = CreateBundleForm(
                 instance=bundle, data=request.POST
             )
-            if createbundleform.is_valid():
-                createbundleform.save()
+            if create_bundle_form.is_valid():
+                create_bundle_form.save()
                 bundle.append_patch(patch)
                 bundle.save()
-                createbundleform = CreateBundleForm()
+                create_bundle_form = CreateBundleForm()
                 messages.success(request, 'Bundle %s created' % bundle.name)
         elif action == 'addtobundle':
             bundle = get_object_or_404(
@@ -142,8 +142,8 @@ def patch_detail(request, project_id, msgid):
     )
     context['submission'] = patch
     context['editable'] = editable
-    context['patchform'] = form
-    context['createbundleform'] = createbundleform
+    context['patch_form'] = form
+    context['create_bundle_form'] = create_bundle_form
     context['project'] = patch.project
     context['related_same_project'] = related_same_project
     context['related_different_project'] = related_different_project