{"action":"created","issue":{"url":"https://api.github.com/repos/django-money/django-money/issues/427","repository_url":"https://api.github.com/repos/django-money/django-money","labels_url":"https://api.github.com/repos/django-money/django-money/issues/427/labels{/name}","comments_url":"https://api.github.com/repos/django-money/django-money/issues/427/comments","events_url":"https://api.github.com/repos/django-money/django-money/issues/427/events","html_url":"https://github.com/django-money/django-money/pull/427","id":335989613,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3NTUwNDEx","number":427,"title":"fix(ModelWithNullableCurrency): error was raised when trying to do a select","user":{"login":"Woile","id":2585816,"node_id":"MDQ6VXNlcjI1ODU4MTY=","avatar_url":"https://avatars0.githubusercontent.com/u/2585816?v=4","gravatar_id":"","url":"https://api.github.com/users/Woile","html_url":"https://github.com/Woile","followers_url":"https://api.github.com/users/Woile/followers","following_url":"https://api.github.com/users/Woile/following{/other_user}","gists_url":"https://api.github.com/users/Woile/gists{/gist_id}","starred_url":"https://api.github.com/users/Woile/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Woile/subscriptions","organizations_url":"https://api.github.com/users/Woile/orgs","repos_url":"https://api.github.com/users/Woile/repos","events_url":"https://api.github.com/users/Woile/events{/privacy}","received_events_url":"https://api.github.com/users/Woile/received_events","type":"User","site_admin":false},"labels":[{"id":643097814,"node_id":"MDU6TGFiZWw2NDMwOTc4MTQ=","url":"https://api.github.com/repos/django-money/django-money/labels/bug","name":"bug","color":"EE3F46","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-26T21:03:00Z","updated_at":"2018-06-27T06:09:19Z","closed_at":"2018-06-27T06:09:11Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/django-money/django-money/pulls/427","html_url":"https://github.com/django-money/django-money/pull/427","diff_url":"https://github.com/django-money/django-money/pull/427.diff","patch_url":"https://github.com/django-money/django-money/pull/427.patch"},"body":"Hello everyone, I found this weird error, I also added a patch, but I would like someone to take a first look.\r\n\r\nFor the error observe the first test I've added:\r\n\r\n```python\r\ndef test_no_fail_all(self):\r\n    money = Money(100, 'EUR')\r\n    instance = ModelWithNullableCurrency(money=money)\r\n    instance.save()\r\n    r = ModelWithNullableCurrency.objects.all()\r\n    assert r[0].money == money\r\n```\r\nAfter doing that an error like this appears:\r\n\r\n```python\r\n~/projects/tmp/venv/lib/python3.6/site-packages/django/db/models/base.py in __init__(self, *args, **kwargs)\r\n    500                 if val is _DEFERRED:\r\n    501                     continue\r\n--> 502                 _setattr(self, field.attname, val)\r\n    503         else:\r\n    504             # Slower, kwargs-ready version.\r\n\r\n~/projects/tmp/venv/lib/python3.6/site-packages/djmoney/models/fields.py in __set__(self, obj, value)\r\n    115         if value is not None and self.field._currency_field.null and not isinstance(value, MONEY_CLASSES):\r\n    116             # For nullable fields we need either both NULL amount and currency or both NOT NULL\r\n--> 117             raise ValueError('Missing currency value')\r\n    118         if isinstance(value, BaseExpression):\r\n    119             if isinstance(value, Value):\r\n\r\nValueError: Missing currency value\r\n```\r\n\r\nSteps to reproduce:\r\n1. Create instance an assigned a Money value\r\n2. Save instance\r\n3. Do a Model.objects.all()\r\n4. Observe \"ValueError: Missing currency value\""},"comment":{"url":"https://api.github.com/repos/django-money/django-money/issues/comments/400553854","html_url":"https://github.com/django-money/django-money/pull/427#issuecomment-400553854","issue_url":"https://api.github.com/repos/django-money/django-money/issues/427","id":400553854,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDU1Mzg1NA==","user":{"login":"Stranger6667","id":1236561,"node_id":"MDQ6VXNlcjEyMzY1NjE=","avatar_url":"https://avatars2.githubusercontent.com/u/1236561?v=4","gravatar_id":"","url":"https://api.github.com/users/Stranger6667","html_url":"https://github.com/Stranger6667","followers_url":"https://api.github.com/users/Stranger6667/followers","following_url":"https://api.github.com/users/Stranger6667/following{/other_user}","gists_url":"https://api.github.com/users/Stranger6667/gists{/gist_id}","starred_url":"https://api.github.com/users/Stranger6667/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Stranger6667/subscriptions","organizations_url":"https://api.github.com/users/Stranger6667/orgs","repos_url":"https://api.github.com/users/Stranger6667/repos","events_url":"https://api.github.com/users/Stranger6667/events{/privacy}","received_events_url":"https://api.github.com/users/Stranger6667/received_events","type":"User","site_admin":false},"created_at":"2018-06-27T06:09:19Z","updated_at":"2018-06-27T06:09:19Z","author_association":"COLLABORATOR","body":"Thank you! :)"}}
{"actor":{"display_login":"Stranger6667"}}