Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#10445 closed (fixed)

Custom comment form example doesn't show submit button

Reported by: nab Owned by: kkubasik
Component: Documentation Version: 1.0
Severity: Keywords: kkmegapatch
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description

Django's comments framework: http://docs.djangoproject.com/en/dev/ref/contrib/comments/#rendering-a-custom-comment-form

The following snippet doesn't show the submit button:

{% get_comment_form for event as form %}
<form action="{% comment_form_target %}" method="POST">
  {{ form }}
  <p class="submit">
    <input type="submit" name="preview" class="submit-post" value="Preview">
  </p>
</form>

Should be something of the form:

{% get_comment_form for event as form %}
<form action="{% comment_form_target %}" method="POST">
  {{ form }}
    <tr>
      <td></td>
      <td><input type="submit" name="preview" class="submit-post" value="Preview"></td>
    </tr>
</form>

Attachments (1)

updated_form.diff (730 bytes) - added by programmerq 5 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 5 years ago by jacob

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 5 years ago by programmerq

comment:2 Changed 5 years ago by programmerq

  • Triage Stage changed from Accepted to Ready for checkin

comment:3 Changed 5 years ago by mtredinnick

  • Has patch set
  • Patch needs improvement set
  • Triage Stage changed from Ready for checkin to Accepted

How about if we fix the whole problem? The form, as given in the docs, is pretty broken. It claims to be an entire form, but spits out HTML tr and td elements without putting them inside a table. That's why the problem occurs. It's probably not a bad idea to put the submit button in a "p" element, for easier styling. The trick is to remember to close the table element first. Which means we should probably open it as well. (The other motivation for using a paragraph element there is to provide a subtle lead that they're not always required to only use table elements or only use list elements or whatever: they can use the appropriate HTML element in the appropriate place.)

Even if we go end up going with putting the submit button into the table, we should include the table elements

comment:4 Changed 5 years ago by kkubasik

  • Keywords kkmegapatch added
  • Owner changed from nobody to kkubasik

comment:5 Changed 5 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

Fixed by [10303].

comment:6 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.