[Zope3-Users] Redirect to Editform

Stephan Richter srichter at cosmos.phy.tufts.edu
Sat Nov 12 07:51:24 EST 2005


On Tuesday 08 November 2005 07:11, Marita Werner wrote:
> I want to add an object and after clicking on the "Add" Button there
> should be a redirect to an editform.
>
> I read Stephan Richters book about "messageboard" and read about nextUrl
> but that does not help me.

Why does that not help you? nextURL() is really the method you want to 
override in your custom add view class. I know why it seems difficult though. 
Here is the scoop. You probably have troubles getting to the created content 
object.

The trick is to override the add() method as well, so that you can store the 
new content object's absolute URL:

  def add(self, content):
    located = self.context.add(content)
    self.absURL = zapi.absoluteURL(located, self.request)
    return located

  def nextURL(self):
    return self.absURL + '@@edit.html'

Note that I did not test the code, but it should be correct.

Regards,
Stephan




-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list