Chois Feld value dynamisch erstellen, schema, formlib

Vladislav Vorobiev <[email protected]>
Newsgroups gmane.comp.web.zope.german
Message-ID <[email protected]>
Hallo,

kann mir jemand Sagen wie ich auf die Datenbank zugreifen kann, um das
 für  Choice Feld das Value dynamisch zu erstellen.

Hier meine Klasse:

class IClass(Interface):
    name = TextLine(
        title=u"Title",
        description=u"Description",
        required = True
        )

    ref=Choice(title=u'Subject',
               #vocabulary = Choice(source=Was()),
               #tt=ermitteln
               tt=(('1', 'AAA'),('2', 'BBB'))
               vocabulary = SimpleVocabulary.fromItems(tt),
               required=True,
               )

class Formular(PageForm):
    „Formular“
    result_template = ViewPageTemplateFile('formEvent.pt')
    form_fields = form.Fields(IClass)

    def __call__(self):
        return super(Formular, self).__call__()

configure.zcml
<browser:page
name="addNew"
for="Products.MeineClasse.interfaces.IMeineClasse"
class="Products.MeineClasse.browser.Class.Formular"
permission="five.ManageSite"
/>

tt sollte also dünamischen Content liefern. z.B

tt=[]
for i in self.pfadZumObject.objectIds():
  tt.append((i, i))

Ich verstehe nicht so ganz wie ich von der Interface klasse bzw. in
diesem Fall überhaupt auf die Datenbank zugreifen kann.

Vielen Dank
Vlad



_______________________________________________
zope mailing list
[email protected]
https://mail.dzug.org/mailman/listinfo/zope
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.