コード例 #1
0
ファイル: addform.py プロジェクト: gyst/grokcore.formlib
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))
コード例 #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.'
コード例 #3
0
class Edit2(grok.EditForm):
    grok.context(Mammoth2)

    form_fields = grok.AutoFields(Mammoth).omit('name')
コード例 #4
0
class Edit(grok.EditForm):
    grok.context(Mammoth)

    form_fields = grok.AutoFields(Mammoth).omit('size')
コード例 #5
0
class Edit(grok.EditForm):
    form_fields = grok.AutoFields(IMammoth)
コード例 #6
0
class Edit2(grok.EditForm):
    grok.context(Mammoth)

    form_fields = grok.AutoFields(Mammoth)