Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set size on all / individual fields #13

Open
AaronPresley opened this issue Apr 7, 2012 · 1 comment
Open

Set size on all / individual fields #13

AaronPresley opened this issue Apr 7, 2012 · 1 comment

Comments

@AaronPresley
Copy link

Love this! Thanks for writing it. Quick thought:

It would be nice to be able to set the size when displaying the fields (either for all or individual). I believe the 2.x syntax is by adding a "span[x]" class to the input element.

http://twitter.github.com/bootstrap/base-css.html#forms

Thanks again!

@esquevin
Copy link

esquevin commented Jun 8, 2012

The way I have been implementing it is by overriding the init method of my form

def __init__(self, *args, **kwargs):
    super(MyForm, self).__init__(*args, **kwargs)
    classes = {
        'title': 'span12',
        'description': 'span12',
        'picture': 'span5',
    }
    for field, css in classes.items():
        if field in self.fields: 
            self.fields[field].widget.attrs['class'] = css

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants