Have a basic question about how to show to tags in one within Django framework.
I would like my HTML table looks like:
HTML Table Object:
<table>
<tr>
<td>Cell1</td>
<td>Cell2</td>
</tr>
</table>
Current Django code
from django import forms
class PFAMInp(forms.Form):
Cell1 = forms.CharField(widget=forms.Textarea (attrs={'cols': 20, 'rows': 2}))
Cell2 = forms.FloatField(required=True)
Later I am using Python to convert this Django form into HTML on GAE.
Python code to generate html
class PFAMInputPage(webapp.RequestHandler):
def get(self):
html = html + str(PFAMdb.PFAMInp())
self.response.out.write(html)
app = webapp.WSGIApplication([('/.*', PFAMInputPage)], debug=True)
def main():
run_wsgi_app(app)
if __name__ == '__main__':
main()
My question is:
Is there a way to customize this django template to make it show two in one row, rather than showing two tags? Thanks for any suggestions.
You have the option of calling the form using
Form.as_p()orForm.as_ul()which will print the form as a series of<p>tags or<li>tags, respectively.The full API specification is here.
Here’s an example of how this might work: