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
Add support for Bootstrap 3 templates #209
Comments
@maraujop, I'm going to go ahead and duplicate the bootstrap template pack and make a bootstrap_v3 template pack to maintain backwards compat. I'll send a pull request when I'm done so you can check it out. |
Thanks James! I really appreciate your effort, what do you think of naming it simply Cheers, |
Sure. On looking over it some more it's probably going to require some python changes as well, but I'll see what I can do. Sent from my iPhone
|
@maraujop Didn't take as long as I thought it would. Check it out. I did a little cleanup around some of the layout objects as well. |
@maraujop Can you please merge this in. I would rather pull from you than @jamesmfriedman although I will. |
This feature is really wanted. It would be very nice to merge it into master and release new version on pypi. |
Hi @vgarvardt and @rh0dium I've just merged this in into Cheers, |
Thanks Miguel. Apparently the checkboxes are borked. I thought I checked them... Anyways, worth a look, probably something simple. |
@maraujop Definitely don't do a release until Bootstrap3 is out of RC! Those guys are having a party changing things in the 9th inning...I'm going to make another pull request with some more of the changes they've recently implemented. |
Hi! I've been using the latest dev commit of crispy forms in order to play with the Bootstrap 3 support. The only thing I'm missing is the support for horizontal forms (http://getbootstrap.com/css/#forms-horizontal). To support them I manually changed the bootstrap3/field.html template to add the "col-xx" classes and setting the "form-horizontal" class when creating the FormHelper for my form. Is this the correct way to go for now or is there a more elegant way? (One that doesn't involve modifying the source code of the project). Thanks! |
This is just my opinion, but I think trying to accommodate this would be a lot of clutter in the code. When I get into horizontal forms or more detailed layouts, I tend to just use the as_crispy_field filter and just write the surrounding stuff manually in the templates. Anyone else got any thoughts on it? Sent from my iPhone
|
I've patched the fields I'm using, but it gives the idea. It adds vars label_class and field_class to the templates. Usage: self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-10' incomplete patch: https://gist.github.com/danielmt/6250312 |
Ticket about horizontal forms: #223 |
@maraujop since bootstrap is already released, do you have an ETA for version 1.4.0 ? |
Accordion was changed to Collapsible, will not be better to change the name of the objects as well? https://github.com/maraujop/django-crispy-forms/blob/dev/crispy_forms/bootstrap.py#L267 I can create Collapsible and CollapsibleGroup and add them to keep backwards compatibility, do you think is worth? |
Ok, Based on Daniel's ( @danielmt ) work, I've pushed a patch for bootstrap 3 horizontal forms. It works the same way as his usage. Thanks Daniel, next time feel free to open a Pull Request. BTW I've added you to CONTRIBUTORS file. self.helper.form_class = 'form-horizontal'
self.helper.label_class = 'col-lg-2'
self.helper.field_class = 'col-lg-10' It is now working with all layout objects, AFAIK. I consider this unfinished, I want to add tests and think some use cases carefully. I will keep this thread updated. @camilonova I think version 1.4.0 will be hopefully released this week. I want to work on docs and tests, meanwhile people can tests some recent changes. BTW at the moment I don't it's worth renaming those layout objects, let's keep them like they are. Cheers, |
Cool, thanks Camilo Nova On Wednesday, 28 de August de 2013 at 13:22, Miguel Araujo wrote:
|
filter doesn't work with horizontal forms. Docstring says to use |
Bootstrap is going into RC for version 3. It contains some minor modifications to the the form template structure, noticeably how horizontal forms are rendered (they now use the grid layout system).
The text was updated successfully, but these errors were encountered: