Skip to content

update_values rules in models #22

Description

@josejachuf

Hi,

All the following happens to me using the latest versions of Emmett and Emmett Rest:

emmett 2.5.6
emmett-crypto 0.5.1
emmett-rest 1.5.2

All my models inherit from Signature

class TimeStamp(Model):
    created_at = Field('datetime')
    updated_at = Field('datetime')

    default_values = {
        'created_at': lambda: local_now(),
        'updated_at': lambda: local_now(),
    }

    update_values = {
        'updated_at': lambda: local_now(),
    }

class Signature(TimeStamp):
    refers_to(
        {'created_by': 'User'},
        {'updated_by': 'User'}
        )

    default_values = {
        'created_by': lambda: get_user(),
        'updated_by': lambda: get_user(),
    }

    update_values = {
        'updated_by': lambda: get_user(),
    }

What I am seeing that I have update a record from the API Rest, the updates are not worked, this is updated_at and updated_by maintain the value of when the record was created

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions