示例#1
0
import flatland as fl
import flask
import database

from common import (CommonString, CommonDict, SourceField,
                    ThematicCategoryField, GeoScaleField, GeoCoverageField,
                    TimelineField, SteepCategoryField, GMTField, TrendField,
                    IndicatorField)

_GMTsSchema = fl.Dict.with_properties(widget="simple_schema").of(
    CommonString.named('code').with_properties(
        label=u"Code*",
        not_empty_error=u"Please provide the code").using(optional=False),
    SteepCategoryField.named('steep_category').with_properties(
        label=u"Steep category*",
        not_empty_error=u"Please select the steep category").using(
            optional=False, child_type=fl.Integer),
    CommonString.named('description').with_properties(
        label=u"Description*",
        not_empty_error=u"Please provide the description").using(
            optional=False),
    SourceField.named('source').with_properties(
        label=u"Source", not_empty_error=u"Please select the source").using(
            optional=False, child_type=fl.Integer),
    CommonString.named('url').with_properties(
        label=u"URL*",
        not_empty_error=(u"Please provide the URL "
                         u"(to published GMT brief)")).using(optional=False),
    CommonString.named('ownership').with_properties(
        label=u"Ownership*",
        not_empty_error=u"Please provide the ownership").using(optional=False),
示例#2
0
import flask
from werkzeug import secure_filename
from flatland.validation import IsEmail, Converted, Present
from flaskext.babel import lazy_gettext as _

from cites import database
from common import (CommonEnum, CommonDict, CommonString, CommonBoolean,
                    CountryField, CommonInteger, CommonDate,
                    labels_for_values, interpolate)


_PersonSchemaDefinition = fl.Dict.with_properties(widget="schema") \
                                 .of(

    CommonString.named("printout_representing")
                .using(label="")
                .with_properties(widget="hide"),

    CommonString.named("token")
                 .using(label="", optional=True)
                 .with_properties(widget="hide"),

    CommonString.named("photo")
                 .using(label="", optional=True)
                 .with_properties(widget="hide"),

    CommonDict.named("personal")
              .using(label="")
              .of(

        CommonEnum.named("name_title")
示例#3
0
import flatland as fl
from flatland.validation import Converted
from cites import database
from common import (CommonEnum, CommonDict, CommonString, CommonBoolean,
                    CommonDate)
from refdata import countries_regions, countries_date1_types


_CountrySchemaDefinition = fl.Dict.with_properties(widget="group") \
                             .of(

        CommonString.named("iso") \
                    .using(label=u"ISO", optional=False) \
                    .with_properties(css_class="input-big"),

        CommonString.named("en") \
                    .using(label="English name", optional=False),

        CommonString.named("es") \
                    .using(label="Spanish name"),

        CommonString.named("fr") \
                    .using(label="French name"),

        CommonEnum.named("region") \
                  .valued(*sorted(countries_regions.keys())) \
                  .with_properties(value_labels=countries_regions) \
                  .using(label=u"Region", optional=False),

        fl.Dict.named('date1') \
               .using(label='Date 1', optional=True) \
示例#4
0
import flatland
from flaskext.babel import gettext as _

from common import I18nString, CommonString, CommonEnum, CommonList, ListValue,\
                   GoalEnumValue, CommonI18nString, CommonInteger, EnumValue, \
                   RuntimeTargetsCommonList, RuntimeActionsCommonList, RuntimeListValue
from .refdata import goals, targets, mapping, indicator_data

_GoalSchemaDefinition = flatland.Dict.of(
            CommonString.named('short_title'),
            I18nString.named('title')
                .using(label=_(u'Title')),
            I18nString.named('description')
                .using(label=_(u"Description")),
            CommonString.named('id'),
        )

_IndicatorSchemaDefinition = flatland.Dict.with_properties(widget="tabel_form").of(
            CommonInteger.named('id')
                .with_properties(widget="hidden"),
            CommonI18nString.named('name')
                .using(label=_("Operational Indicator")),
            CommonI18nString.named('question')
                .using(label=_("Communication Question")),
            CommonEnum.named('goal')
                .valued(*sorted(goals.keys()))
                .using(label=_("Strategic Goal"))
                .with_properties(widget="select", value_labels=goals),
            CommonI18nString.named('head_indicator')
                .using(label=_("Headline Indicator")),
            CommonI18nString.named('sub_indicator')