Exemple #1
0
class AddMammoth(grok.AddForm):
    grok.context(Zoo)

    form_fields = grok.AutoFields(Mammoth)

    @grok.action('Add entry')
    def add(self, **data):
        # pass data into Mammoth constructor
        self.context['manfred'] = manfred = Mammoth(**data)
        self.redirect(self.url(manfred))
Exemple #2
0
class AddMammoth(grok.AddForm):
    grok.context(Zoo)

    form_fields = grok.AutoFields(IMammoth)

    @grok.action('Add entry')
    def add(self, **data):
        self.context['ellie'] = ellie = Mammoth()
        if self.applyData(ellie, **data):
            return 'There were changes according to applyData.'
        return 'There were no changes according to applyData.'
Exemple #3
0
class Edit(grok.EditForm):
    grok.context(Mammoth)

    form_fields = grok.Fields(IMammoth).omit('size')
class Edit2(grok.EditForm):
    grok.context(Mammoth2)

    form_fields = grok.AutoFields(Mammoth).omit('name')
Exemple #5
0
class Index(grok.View):
    grok.context(Mammoth)
    def render(self):
        return 'Hi, my name is %s, and I\'m "%s"' % (self.context.name,
                                                     self.context.size)
Exemple #6
0
class Edit4(grok.EditForm):
    grok.context(IYetAnotherMammoth)
Exemple #7
0
class Edit2(grok.EditForm):
    grok.context(Manfred)
Exemple #8
0
class Edit(grok.EditForm):
    grok.context(Mammoth)
class Edit2(grok.EditForm):
    grok.context(Mammoth)

    form_fields = grok.AutoFields(Mammoth)