If you're worried about stylizing specific fields, it'll be setup as a table, ul, or paragraph based upon how you "render the form" (paragraph by default I think). The individual fields are named with the following convention (if I recall correctly) <input id="id_<field_name>" ... />. So for a field named "password" in a paragraph rendered form, it'll end up sort of like this:
<p><label for="id_password">password</label><input type="password" name="password" id="id_password" /></p> Of course I don't use these pre-rendered forms because mine typically need too much customization. So what we do is the following: <form action="" method="post">{% csrf_token %} ... <input name="password" type="password" value="{{ form.password.value }}" /> <input type="submit" value="Click Me!" /> ... </form> and you can easily add in your own stylizing CSS and elements as needed. On Fri, Mar 23, 2012 at 12:25 PM, Tim Ney <tm...@columbus.rr.com> wrote: > I think the best thing for you do is to create the css outside the > template. Like this - create the css file, separately, then reference the > file in the template. > > Or, better yet, add the css you need for your form in you main css file > that is referenced in your base template and just inherit it by > using a tag {{ extends "base.html""}, then you will have a uniform look > throughout the site and you won't have to worry about but once. > > > > On Fri, Mar 23, 2012 at 3:10 AM, Mario Gudelj <mario.gud...@gmail.com>wrote: > >> It doesn't matter how you generate your form, your CSS should be applied >> from inside the template. You need to add a CSS file link to a template to >> which you're passing the form to inside your context from within a view, or >> you can embed it into your template using <style> tags. >> >> >> On 23 March 2012 09:46, hack <scottma...@gmail.com> wrote: >> >>> I think I shot myself in the foot using ModelForms to generate all of my >>> html forms. Is there any way to use a stylesheet when your forms are >>> generated from ModelForms? >>> >>> I've tried everything and cannot get it to work. I've tried directly >>> importing the css files, I've tried loading them from STATIC, and I've >>> tried setting css in Meta, but nothing seems to work. All I have to do is >>> add some color to my tables and align the text to the left of the cells. >>> Thanks. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django users" group. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msg/django-users/-/d_3ry3L6DuEJ. >>> 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. >>> >> >> -- >> 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. >> > > -- > 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. > -- 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.