canen, Thank you for your reply but I am not sure if I am getting this right. I am getting an "Exception Value: __init__() got an unexpected keyword argument 'attrs'" with the following code
class CreateGuestUserForm(forms.Form): first_name = forms.CharField(label='First Name', attrs={'class':'left'}) I stepped through django code and found the following: >>> class CharField(Field): def __init__(self, max_length=None, min_length=None, *args, **kwargs): self.max_length, self.min_length = max_length, min_length super(CharField, self).__init__(*args, **kwargs) class Field(object): widget = TextInput # Default widget to use when rendering this type of Field. hidden_widget = HiddenInput # Default widget to use when rendering this as "hidden". # Tracks each time a Field instance is created. Used to retain order. creation_counter = 0 def __init__(self, required=True, widget=None, label=None, initial=None, help_text=None): >>> I am new to python and django, but it looks like the Field's init arguments do not recognize "attrs." Thanks Rolly On Apr 25, 3:04 pm, canen <[EMAIL PROTECTED]> wrote: > You would use the attrs argument when declaring the field. > > ..... > first_name = CharField('First name', attrs={'class': 'left'}) > ..... > > On Apr 25, 1:02 pm, RollyF <[EMAIL PROTECTED]> wrote: > > > How do I do this using newforms if I want my output to be: > > > <label for="id_firstname" class="left">First name:</label> > > > I want to know how to pass the "class" to the output. > > > TIA, > > Rolly --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---