Question

I've just started working with Pyramid. I'm using PyCharm as an IDE and I've started with the "starter" scaffold. I'm trying to create some nice looking forms. I've installed deform and deform_bootstap. I've managed to get a form to display but it's not pretty like the examples of the widgets on the http://deformdemo.xo7.de/ajaxform/ site. I'm also am trying to make a tabbed form. I setup my code using this "how to" https://pypi.python.org/pypi/deform_bootstrap but the tabs don't seem to work. The documentation is sparse of this subject. What does the beginner need to know to get a twitter like form up and running? It seems that I'm missing all the wonderful CSS information in the .pt file and maybe that's the issue. Does Fanstatic provide a solution? How do I set all this up?

What's works best? I'm trying to stay away form HTML and CSS as much as possible but still have a clean looking site.

Was it helpful?

Solution 2

Okay, I now have a tabbed form.

  1. Thanks to Sascha, I was able to use form.get_widget_resources() to make everything look pretty.

  2. I was still unable to get the Tabs to display. The fix ended up being simple. I had deform_bootstrap_exta installed which ran on deform_bootstrap 0.2.8. I removed the deform_bootstrap_exta and updated to deform_bootstrap 0.2.9. This solved the problem.

OTHER TIPS

Try ToDoPyramid - one of the recommended pyramid sample applications. It uses deform & bootstrap to render a user account page. It is a nice application and serves well for learning purposes.

It currently depends on packages deform (0.9.4), pyramid_deform (0.2) and deform_bootstrap_extra (0.2.8). Current add-ons depend usually on deform<=1.999

You asked about CSS/JS setup for templates. You need to notice sample code like

form.get_widget_resources()

Depending on your Schema and widgets this call returns paths to JS/CSS that you need to inject into your templates. Background here and here.

After all I am pretty happy with deform & bootstrap add-on packages. It not easy to start with, but afterwards is does a good job.

Latest deform version has demo site and can be setup easily on your development system. Got it running as well. If you manage to work with TodoPyramid then you will notice the differences better. Documentation is currently a bit confusing and not very beginner-friendly. I am pretty sure this will be better, because documentation in pyramid ecosystem is usually very good.

I refactored the TodoPyramid application to encapsulate code using SQLAlchemy (while learning it), make use of pyramid_deform FormView class, optimized deform JS/CSS injection and added tests. May be this will be of any help to you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top