Hi all,

I need to create a table, and this table has 3 attributes:

Name, Host name, and baseline.  I want to make a table able

to display dynamic contents when I choose different baseline and click a
"check" button.

My design is:

Baseline is a set of combo-box and button.
Resource table shows three values: name, host name, and
baseline.

Could anyone give me some more idea?  I really need my
"check" buttonworks.


Many thanks.

*views.py:*

def table_page(request):
    from ddbb.my_app.app_1.models import Resource
    table,baseline={},{'all':0,}
    template = get_template('table.html')
    resource=Resource.objects.all()
    length = len(resource)
    for r in range(1,length+1):
        rc=Resource.objects.get(id=r)
        baseline[rc.baseline] = r

    variables = Context({'head_title':'Resource Table',
                         'page_title':'Resource Table',
                         'page_body':'resource table',
                         'resource':resource,
                         'baseline':baseline,
                         })

    output = template.render(variables)
    return HttpResponse(output)

*table.html*

<html>
<head></head>
<body>
  <h1>Baseline: </h1>
      <select size="1">
        {%for item in baseline  %}
          <option>{{item}}</option>
        {% endfor %}
      </select>
      *<INPUT type="submit" name="Check" value="Check">*
      <br />
</table>
      <TABLE ><TR>
        <TD><b>Name</b></TD>
        <TD><b>Host Name</b></TD>
        <TD><b>Baseline</b></TD>
      </TR>

      {% for r in resource %}
      <TR>
        <TD>{{r.name}}</TD>
        <TD>{{r.hostname}}</TD>
        <TD>{{r.baseline}}</TD>
      </TR>
      {% endfor %}
      <br />
  </body>
</html>



Webber Lin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to