Re: newforms : how to display as_ul from views.py
On 1/15/07, Ramdas S <[EMAIL PROTECTED]> wrote: How do I get the templates to render the following form from the views.py given below as as unordered list, instead of the standard table formt. This is a simple four fields ContactForms, created out of the table Contacts. form.as_ul() Theres also `form.as_p()` and the default `form.as_table()`. You can either use that to pass your form to your context, or you can call it directly in the template. Currently it is emmiting the HTML as as a a table class. def index(request): ContactForm = forms.models.form_for_model(Contacts) if request.method == 'POST': form = ContactForm( request.POST) if form.is_valid(): form.save() return HttpResponse('Message Recd') else: form = ContactForm() t = loader.get_template('contactus.html ') c = Context({'form': form, }) return HttpResponse(t.render(c)) I can make the template behave the way I want to using CSS. But that is not the idea... > -- Waylan Limberg [EMAIL PROTECTED] --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newforms : how to display as_ul from views.py
Ramdas, in your template: {{ form.as_ul }} -- Jeff Bauer Rubicon, Inc. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: newforms : how to display as_ul from views.py
maybe I am missing something but why don't you use {{ form.as_ul }} in your template?? On 1/15/07, Ramdas S <[EMAIL PROTECTED]> wrote: How do I get the templates to render the following form from the views.py given below as as unordered list, instead of the standard table formt. This is a simple four fields ContactForms, created out of the table Contacts. Currently it is emmiting the HTML as as a a table class. def index(request): ContactForm = forms.models.form_for_model(Contacts) if request.method == 'POST': form = ContactForm( request.POST) if form.is_valid(): form.save() return HttpResponse('Message Recd') else: form = ContactForm() t = loader.get_template('contactus.html ') c = Context({'form': form, }) return HttpResponse(t.render(c)) I can make the template behave the way I want to using CSS. But that is not the idea... > -- Honza Kr l E-Mail: [EMAIL PROTECTED] ICQ#: 107471613 Phone: +420 606 678585 --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
newforms : how to display as_ul from views.py
How do I get the templates to render the following form from the views.pygiven below as as unordered list, instead of the standard table formt. This is a simple four fields ContactForms, created out of the table Contacts. Currently it is emmiting the HTML as as a a table class. def index(request): ContactForm = forms.models.form_for_model(Contacts) if request.method == 'POST': form = ContactForm(request.POST) if form.is_valid(): form.save() return HttpResponse('Message Recd') else: form = ContactForm() t = loader.get_template('contactus.html') c = Context({'form': form, }) return HttpResponse(t.render(c)) I can make the template behave the way I want to using CSS. But that is not the idea... --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---