Code

Opened 6 years ago

Closed 5 years ago

#9604 closed (duplicate)

a patch to the docs regarding "how a complete example form could look like"

Reported by: vak <khamenya@…> Owned by: nobody
Component: contrib.comments Version: master
Severity: Keywords: doc patch
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

there is an example of a complete form in the section "RENDERING A CUSTOM COMMENT FOR" on this page: http://docs.djangoproject.com/en/dev/ref/contrib/comments/

it is not fully correct, because:

  1. the example results in a list of tr elements not surrounded by table element.
  2. the button below the form is a mess between "preview" and "post".

the example might be like:

<h2>Post a comment</h2>
{% get_comment_form for blog.entry 1 as form %}
<div id="myform">
    <form action="{% comment_form_target %}" method="POST">
      <table>
        {{ form }}
        <tr id="action_buttons">
          <th/>
          <td>
            <input type="submit" name="submit" class="preview-post" value="Preview">
            <input type="submit" name="submit" class="submit-post" value="Post">
          </td>
        </tr>
      </table>
    </form>
</div>

and a few lines of the following stylesheet

<style type="text/css">
#myform label[for="id_honeypot"], #myform input#id_honeypot {
  display:none
}

#myform table th, #myform #action_buttons {
  text-align:right
}
</style>

will help to all newbies like I am.

regards,
Valer

Attachments (0)

Change History (3)

comment:1 Changed 6 years ago by mtredinnick

  • Has patch unset
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

If somebody wants to make a patch for something like this, it would be a start.

Note, however, that there's no need to include CSS in the example. There's nothing Django-specific about that and, in the above example, it's all up to whomever writes the template. However, the documentation for comments could mention any specific CSS classes that the template tags create (if there are any).

Also, the example template fragment isn't correct, since there shouldn't be two controls for separate purposes with the same "name" attribute (it's broken for internationalisation purposes). The template fragments in the comments application show the correct approach.

(I don't know why "has patch" has been checked here, since there's no patch attached.)

comment:2 Changed 5 years ago by thejaswi_puthraya

Subset of #9819 that has a patch (w/o the CSS).

comment:3 Changed 5 years ago by jezdez

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

Closing as duplicate in favor of #9819.

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.