Hi,<br>I am working through the chapter 5 source code from the Grok development book and I get an Attribute error. <br><br>id = str(self.next_id)<br>AttributeError: 'Project' object has no attribute 'next_id'<br>
<br>Which seems to be caused by this line: <br><br>form_fields = grok.AutoFields(Project).omit('next_id')<br><br>Because the field is omitted from the form.<br>It is in the interface definition.<br><br>How can I omit a field from the form and still see it in the methods?<br>
The code I am using is unaltered from the book. <br>This is the add project code:<br><br>class AddProjectForm(grok.AddForm):<br> grok.context(Todo)<br> <a href="http://grok.name">grok.name</a>('index')<br> form_fields = grok.AutoFields(Project).omit('next_id')<br>
<br> label = "To begin, add a new project"<br> template = grok.PageTemplateFile('<a href="http://custom_edit_form.pt">custom_edit_form.pt</a>')<br><br> @grok.action('Add project')<br> def add(self,**data):<br>
project = Project()<br> self.applyData(project,**data)<br> id = str(self.context.next_id)<br> self.context.next_id = self.context.next_id+1<br> self.context[id] = project<br> return self.redirect(self.url(self.context[id]))<br>
<br>Thanks<br>