{"action":"closed","issue":{"url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1295","repository_url":"https://api.github.com/repos/MongoEngine/mongoengine","labels_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1295/labels{/name}","comments_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1295/comments","events_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1295/events","html_url":"https://github.com/MongoEngine/mongoengine/issues/1295","id":154613860,"number":1295,"title":"to_dict does not work for attributes that it has assigned on signal method","user":{"login":"rafaelreuber","id":127780,"avatar_url":"https://avatars.githubusercontent.com/u/127780?v=3","gravatar_id":"","url":"https://api.github.com/users/rafaelreuber","html_url":"https://github.com/rafaelreuber","followers_url":"https://api.github.com/users/rafaelreuber/followers","following_url":"https://api.github.com/users/rafaelreuber/following{/other_user}","gists_url":"https://api.github.com/users/rafaelreuber/gists{/gist_id}","starred_url":"https://api.github.com/users/rafaelreuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafaelreuber/subscriptions","organizations_url":"https://api.github.com/users/rafaelreuber/orgs","repos_url":"https://api.github.com/users/rafaelreuber/repos","events_url":"https://api.github.com/users/rafaelreuber/events{/privacy}","received_events_url":"https://api.github.com/users/rafaelreuber/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-13T01:10:43Z","updated_at":"2016-05-13T01:25:01Z","closed_at":"2016-05-13T01:25:01Z","body":"I'm facing problems with document attributes that I assign values inside a signal method.\r\nThey are missing if I try to get it using to_mongo method.\r\n\r\n```\r\nfrom datetime import datetime\r\nfrom random import randint\r\nfrom mongoengine import *\r\nfrom mongoengine import signals\r\n\r\nconn = connect(\"test\")\r\n\r\nclass Person(Document):\r\n    name = StringField()\r\n    age = IntField()\r\n    creation = DateTimeField()\r\n    number = IntField()\r\n\r\n    @classmethod\r\n    def pre_init(cls, sender, document, **kwargs):\r\n        print(\"Co\")\r\n        sender.number = 10\r\n        sender.creation = datetime.now()\r\n\r\n\r\nsignals.pre_init.connect(Person.pre_init, sender=Person)\r\n\r\nme = Person(name=\"Reuber\", age=30)\r\nme_dict = me.to_mongo().to_dict()\r\n\r\nassert me.number == 10\r\nassert isinstance(me.creation, datetime)\r\n\r\n# I get a error rigth here\r\nassert me_dict.get('number') == 10\r\nassert isinstance(me_dict.get('creation'), datetime)\r\n```"}}