macroprocesso.py
1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# -*- coding: utf-8 -*-
from zope import schema
from plone.dexterity.content import Container
from plone.supermodel import model
from plone.autoform import directives as form
from z3c.form.browser.text import TextWidget
from plone.app.z3cform.wysiwyg import WysiwygFieldWidget
from five import grok
from plone.namedfile.field import NamedBlobImage
from pf.biblioteca import MessageFactory as _
class IMacroProcesso(model.Schema):
"""
Macroprocesso
"""
# http://docs.plone.org/external/plone.app.dexterity/docs/reference/fields.html
# http://docs.plone.org/external/plone.app.dexterity/docs/reference/widgets.html
# https://pythonhosted.org/z3c.form/browser/README.html
# http://docs.plone.org/develop/addons/schema-driven-forms/customising-form-behaviour/widgets.html
# https://pypi.python.org/pypi/plone.autoform
form.widget('title', TextWidget, klass="macroprocesso-title")
title = schema.TextLine(
title=_(u"Título"),
description=u'',
required=True,
max_length=55
)
description = schema.Text(
title=_(u"Descrição"),
description=u"",
required=False,
)
form.widget(description=WysiwygFieldWidget)
imagem = NamedBlobImage(
title=_(u"Imagem do Macroprocesso"),
description=_(u"Selecione uma imagem representativa do Macroprocesso"),
required=True,
)
class MacroProcesso(Container):
grok.implements(IMacroProcesso)
def canSetDefaultPage(self):
""" User don't can set default page """
return False