{"action":"opened","issue":{"url":"https://api.github.com/repos/jonashagstedt/swampdragon/issues/89","labels_url":"https://api.github.com/repos/jonashagstedt/swampdragon/issues/89/labels{/name}","comments_url":"https://api.github.com/repos/jonashagstedt/swampdragon/issues/89/comments","events_url":"https://api.github.com/repos/jonashagstedt/swampdragon/issues/89/events","html_url":"https://github.com/jonashagstedt/swampdragon/issues/89","id":81095367,"number":89,"title":"SelfPublishModel with field primary_key=True and default","user":{"login":"fatrix","id":102456,"avatar_url":"https://avatars.githubusercontent.com/u/102456?v=3","gravatar_id":"","url":"https://api.github.com/users/fatrix","html_url":"https://github.com/fatrix","followers_url":"https://api.github.com/users/fatrix/followers","following_url":"https://api.github.com/users/fatrix/following{/other_user}","gists_url":"https://api.github.com/users/fatrix/gists{/gist_id}","starred_url":"https://api.github.com/users/fatrix/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fatrix/subscriptions","organizations_url":"https://api.github.com/users/fatrix/orgs","repos_url":"https://api.github.com/users/fatrix/repos","events_url":"https://api.github.com/users/fatrix/events{/privacy}","received_events_url":"https://api.github.com/users/fatrix/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-26T19:11:16Z","updated_at":"2015-05-26T19:11:16Z","closed_at":null,"body":"I'm having a Model for self publishing:\r\n\r\n    class MyModel(SelfPublishModel, models.Model):\r\n        modelid = models.IntegerField(primary_key=True, default=create_pk)\r\n\r\nin `swampdragon/models.py` on line 83 a check is done with `if not self.pk` to differ if the instance is created or updated. But with a default primary key set on the model, the primary key seems to be set at this state already.\r\n\r\nWould it be an acceptable solution to change the check to `if self._state.adding`?\r\n\r\nIf you agree, I can send a pull request.\r\n\r\n"}}