{"action":"created","issue":{"url":"https://api.github.com/repos/coleifer/peewee/issues/1771","repository_url":"https://api.github.com/repos/coleifer/peewee","labels_url":"https://api.github.com/repos/coleifer/peewee/issues/1771/labels{/name}","comments_url":"https://api.github.com/repos/coleifer/peewee/issues/1771/comments","events_url":"https://api.github.com/repos/coleifer/peewee/issues/1771/events","html_url":"https://github.com/coleifer/peewee/issues/1771","id":375558485,"node_id":"MDU6SXNzdWUzNzU1NTg0ODU=","number":1771,"title":"ArrayField of ForeignKeyFields, is it possible?","user":{"login":"droserasprout","id":10263434,"node_id":"MDQ6VXNlcjEwMjYzNDM0","avatar_url":"https://avatars2.githubusercontent.com/u/10263434?v=4","gravatar_id":"","url":"https://api.github.com/users/droserasprout","html_url":"https://github.com/droserasprout","followers_url":"https://api.github.com/users/droserasprout/followers","following_url":"https://api.github.com/users/droserasprout/following{/other_user}","gists_url":"https://api.github.com/users/droserasprout/gists{/gist_id}","starred_url":"https://api.github.com/users/droserasprout/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/droserasprout/subscriptions","organizations_url":"https://api.github.com/users/droserasprout/orgs","repos_url":"https://api.github.com/users/droserasprout/repos","events_url":"https://api.github.com/users/droserasprout/events{/privacy}","received_events_url":"https://api.github.com/users/droserasprout/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-30T15:44:19Z","updated_at":"2018-10-30T20:54:12Z","closed_at":"2018-10-30T20:54:12Z","author_association":"NONE","body":"Hi!\r\nI'm working with postgresql and peewee 3.7.1 and trying to initialize model's field as an array of ForeignKeyFields this way:\r\n\r\n```python\r\nPreviousTasks = ArrayField(ForeignKeyField, {'model': 'self', 'column_name': 'previous_tasks', 'field': 'ID', 'backref': 'TaskPreviousTasks'})\r\n```\r\nDocs say ArrayField argument field_class gets \"a subclass of Field\" so this should be possible theoretically. But I'm getting this error:\r\n```python\r\n  File \"/opt/app/include/models/tickets.py\", line 176, in <module>\r\n    class Task(ModelBase):\r\n  File \"/opt/app/include/models/tickets.py\", line 191, in Task\r\n    PreviousTasks = ArrayField(ForeignKeyField, {'model': 'self', 'column_name': 'previous_tasks', 'field': 'ID', 'backref': 'TaskPreviousTasks'})\r\n  File \"/usr/local/lib/python3.6/site-packages/playhouse/postgres_ext.py\", line 155, in __init__\r\n    self.field_type = self.__field.field_type\r\n  File \"/usr/local/lib/python3.6/site-packages/peewee.py\", line 4552, in __getattr__\r\n    if attr in self.rel_model._meta.fields:\r\nAttributeError: 'str' object has no attribute '_meta'\r\n```\r\nIs there any way to do this kind of trickery or should I use PreviousTasks as an array of integers and fetch referenced models manually?"},"comment":{"url":"https://api.github.com/repos/coleifer/peewee/issues/comments/434465732","html_url":"https://github.com/coleifer/peewee/issues/1771#issuecomment-434465732","issue_url":"https://api.github.com/repos/coleifer/peewee/issues/1771","id":434465732,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDQ2NTczMg==","user":{"login":"coleifer","id":119974,"node_id":"MDQ6VXNlcjExOTk3NA==","avatar_url":"https://avatars2.githubusercontent.com/u/119974?v=4","gravatar_id":"","url":"https://api.github.com/users/coleifer","html_url":"https://github.com/coleifer","followers_url":"https://api.github.com/users/coleifer/followers","following_url":"https://api.github.com/users/coleifer/following{/other_user}","gists_url":"https://api.github.com/users/coleifer/gists{/gist_id}","starred_url":"https://api.github.com/users/coleifer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coleifer/subscriptions","organizations_url":"https://api.github.com/users/coleifer/orgs","repos_url":"https://api.github.com/users/coleifer/repos","events_url":"https://api.github.com/users/coleifer/events{/privacy}","received_events_url":"https://api.github.com/users/coleifer/received_events","type":"User","site_admin":false},"created_at":"2018-10-30T20:54:12Z","updated_at":"2018-10-30T20:54:12Z","author_association":"OWNER","body":"I wouldn't call that trickery, I'd call it ... well, nevermind.\r\n\r\nJust use an actual junction table. Play to the strengths of your relational database."}}
{"actor":{"display_login":"coleifer"}}