Beispiel #1
0
class ReportsForm(JsonObject):
    time = DateTimeProperty()
    completion_time = DateTimeProperty()
    start_time = DateTimeProperty()
    duration = IntegerProperty()
    submission_time = DateTimeProperty()
    xmlns = StringProperty()
    app_id = StringProperty()
    user_id = StringProperty()
    username = StringProperty()
Beispiel #2
0
class ResumableIteratorState(JsonObject):
    doc_type = "ResumableIteratorState"
    _id = StringProperty()
    name = StringProperty()
    timestamp = DateTimeProperty()
    args = ListProperty()
    kwargs = DictProperty()
    retry = DictProperty()
    progress = DictProperty()
    complete = BooleanProperty(default=False)
Beispiel #3
0
class OPMCase(CommCareCase):
    opened_on = DateTimeProperty(datetime(2010, 1, 1))
    block_name = StringProperty("Sahora")
    type = StringProperty("pregnancy")
    closed = BooleanProperty(default=False)
    closed_on = DateTimeProperty()
    awc_name = StringProperty("Atri")
    owner_id = StringProperty("Sahora")

    def __init__(self, forms=None, **kwargs):
        super(OPMCase, self).__init__(**kwargs)
        self._id = "z640804p375ps5u2yx7"
        self._fake_forms = forms if forms is not None else []

    def get_forms(self):
        return self._fake_forms

    class Meta:
        # This is necessary otherwise tests get sad
        app_label = "opm"
Beispiel #4
0
    def parse():
        if not val:
            return None

        # datetime is a subclass of date
        if isinstance(val, datetime.date):
            return val

        try:
            dt = DateTimeProperty().wrap(val)
        except BadValueError:
            try:
                return DateProperty().wrap(val)
            except BadValueError:
                return val
        else:
            if not any([dt.hour, dt.minute, dt.second, dt.microsecond]):
                return dt.date()
            else:
                return dt
Beispiel #5
0
class ResumableIteratorState(JsonObject):
    doc_type = "ResumableIteratorState"
    _id = StringProperty()
    name = StringProperty()
    timestamp = DateTimeProperty()
    args = ListProperty()
    kwargs = DictProperty()
    progress = DictProperty()

    def is_resume(self):
        return bool(getattr(self, '_rev', None))
Beispiel #6
0
class Foo(jsonobject.JsonObject):
    bar = DateTimeProperty()