{"action":"created","issue":{"url":"https://api.github.com/repos/rbarrois/factory_boy/issues/251","repository_url":"https://api.github.com/repos/rbarrois/factory_boy","labels_url":"https://api.github.com/repos/rbarrois/factory_boy/issues/251/labels{/name}","comments_url":"https://api.github.com/repos/rbarrois/factory_boy/issues/251/comments","events_url":"https://api.github.com/repos/rbarrois/factory_boy/issues/251/events","html_url":"https://github.com/rbarrois/factory_boy/issues/251","id":117791491,"number":251,"title":"Traits","user":{"login":"yelled3","id":818124,"avatar_url":"https://avatars.githubusercontent.com/u/818124?v=3","gravatar_id":"","url":"https://api.github.com/users/yelled3","html_url":"https://github.com/yelled3","followers_url":"https://api.github.com/users/yelled3/followers","following_url":"https://api.github.com/users/yelled3/following{/other_user}","gists_url":"https://api.github.com/users/yelled3/gists{/gist_id}","starred_url":"https://api.github.com/users/yelled3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yelled3/subscriptions","organizations_url":"https://api.github.com/users/yelled3/orgs","repos_url":"https://api.github.com/users/yelled3/repos","events_url":"https://api.github.com/users/yelled3/events{/privacy}","received_events_url":"https://api.github.com/users/yelled3/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rbarrois/factory_boy/labels/Feature","name":"Feature","color":"02d7e1"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-11-19T11:11:38Z","updated_at":"2016-04-03T14:51:55Z","closed_at":"2016-04-02T15:27:36Z","body":"is there a way to do something similar to `factory_girl` Traits?\r\nhttps://github.com/thoughtbot/factory_girl/blob/master/GETTING_STARTED.md#traits\r\n\r\nthe closest thing I was able to come up with is doing:\r\n\r\n```py\r\nclass UserFactory(factory.Factory):\r\n    class Meta:\r\n        model = User\r\n        exclude = ('admin',)\r\n\r\n    admin = False\r\n    role = 'regular'\r\n    if admin:\r\n        role = 'admin'\r\n    \r\nuser = UserFactory.build()\r\nadmin_user = UserFactory.build(admin=True)\r\n```\r\n\r\nwhich is not all that bad - but I don't like the whole `exclude` hack.\r\n"},"comment":{"url":"https://api.github.com/repos/rbarrois/factory_boy/issues/comments/204992333","html_url":"https://github.com/rbarrois/factory_boy/issues/251#issuecomment-204992333","issue_url":"https://api.github.com/repos/rbarrois/factory_boy/issues/251","id":204992333,"user":{"login":"iwz","id":141314,"avatar_url":"https://avatars.githubusercontent.com/u/141314?v=3","gravatar_id":"","url":"https://api.github.com/users/iwz","html_url":"https://github.com/iwz","followers_url":"https://api.github.com/users/iwz/followers","following_url":"https://api.github.com/users/iwz/following{/other_user}","gists_url":"https://api.github.com/users/iwz/gists{/gist_id}","starred_url":"https://api.github.com/users/iwz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iwz/subscriptions","organizations_url":"https://api.github.com/users/iwz/orgs","repos_url":"https://api.github.com/users/iwz/repos","events_url":"https://api.github.com/users/iwz/events{/privacy}","received_events_url":"https://api.github.com/users/iwz/received_events","type":"User","site_admin":false},"created_at":"2016-04-03T14:51:55Z","updated_at":"2016-04-03T14:51:55Z","body":"Nice! Thanks @rbarrois!!"}}