Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

zc.formlib and content types

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


miles at jamkit

Jan 26, 2009, 6:41 AM

Post #1 of 4 (460 views)
Permalink
zc.formlib and content types

Hi,

I've been playing with zc.formlib and five to create some simple content
types - not exactly ahead of the curve, I know!

I want to create a multipage "wizard"-type form. Each page shares a lot
of logic, so at the moment I have one view class, and register different
templates against it for the various changes. However, with formlib,
I can't see how I'd do this. Is there a more elegant solution than just
creating 3 separate forms?

Thanks for your help,

Miles


_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


miles at jamkit

Jan 26, 2009, 6:44 AM

Post #2 of 4 (422 views)
Permalink
zc.formlib and content types [In reply to]

Hi,

I was playing with using zc.formlib and five to create some content
types - not exactly ahead of the curve, I know. I have it all working
fine for basic edit/add forms.

I want to replace one of the operations in a site that is a multi-page
"wizard" with something based on zc.formlib. Previously, the entire
process is part of one view class, as it shares a lot of logic. Is
there an elegant way to do this rather than creating 3 separate forms?
What's the "preferred" method for achieving a multipage form.

I googled for examples, but didn't find anything relevant to this.

Thanks for your help,

Miles


_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


r.ritz at biologie

Jan 26, 2009, 7:53 AM

Post #3 of 4 (425 views)
Permalink
Re: zc.formlib and content types [In reply to]

Miles wrote:
> Hi,
>
> I was playing with using zc.formlib and five to create some content
> types - not exactly ahead of the curve, I know. I have it all working
> fine for basic edit/add forms.
>
> I want to replace one of the operations in a site that is a multi-page
> "wizard" with something based on zc.formlib. Previously, the entire
> process is part of one view class, as it shares a lot of logic. Is
> there an elegant way to do this rather than creating 3 separate forms?
> What's the "preferred" method for achieving a multipage form.
>

Not sure you can call it 'preferred' but IIRC z3c.form has been
developed with that particular use case in mind (and many others)

http://pypi.python.org/pypi?%3Aaction=search&term=z3c.form&submit=search

also gives pointers to how z3c.form is used, extended, how it is
used in Zope 2 (plone.z3cform - don't be confused by the name: this
isn't Plone specific, it's "just" contributed by the Plone community)
and to applications using it.

Raphael


> I googled for examples, but didn't find anything relevant to this.
>
> Thanks for your help,
>
> Miles
>
>
> _______________________________________________
> Zope-CMF maillist - Zope-CMF[at]lists.zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
>
> See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests
>

_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Jan 26, 2009, 8:11 AM

Post #4 of 4 (426 views)
Permalink
Re: zc.formlib and content types [In reply to]

Am 26.01.2009 um 15:41 schrieb Miles:

> Hi,
>
> I've been playing with zc.formlib and five to create some simple
> content
> types - not exactly ahead of the curve, I know!
>
> I want to create a multipage "wizard"-type form. Each page shares a
> lot
> of logic, so at the moment I have one view class, and register
> different
> templates against it for the various changes. However, with
> formlib,
> I can't see how I'd do this. Is there a more elegant solution than
> just
> creating 3 separate forms?


Hiya Miles,

are you playing with formlib or zc3.form? Formlib lets you override
templates pretty easily by redefining the template attribute for each
view (please don't rely on the following paths!):

class PageOne(CMFDefault.formlib.form.PageForm):
"""class with most of the logic"""

template = "templates/first_template.pt"

class PageTwo(PageOne):

"""logic stays the same but the template has to be different"""

template = "templates/second_template.pt"

class PageThree(PageOne):

template = "templates/second_template.pt"

NB. this assumes that your form templates share the same macro for
rendering the actual widgets and should be used when you really need
different templates.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF[at]lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.