{"action":"created","issue":{"url":"https://api.github.com/repos/radiac/django-tagulous/issues/9","labels_url":"https://api.github.com/repos/radiac/django-tagulous/issues/9/labels{/name}","comments_url":"https://api.github.com/repos/radiac/django-tagulous/issues/9/comments","events_url":"https://api.github.com/repos/radiac/django-tagulous/issues/9/events","html_url":"https://github.com/radiac/django-tagulous/issues/9","id":119715856,"number":9,"title":"TagField and django tastypie POST resource is not saving m2m relationship.","user":{"login":"sgmart","id":1746954,"avatar_url":"https://avatars.githubusercontent.com/u/1746954?v=3","gravatar_id":"","url":"https://api.github.com/users/sgmart","html_url":"https://github.com/sgmart","followers_url":"https://api.github.com/users/sgmart/followers","following_url":"https://api.github.com/users/sgmart/following{/other_user}","gists_url":"https://api.github.com/users/sgmart/gists{/gist_id}","starred_url":"https://api.github.com/users/sgmart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgmart/subscriptions","organizations_url":"https://api.github.com/users/sgmart/orgs","repos_url":"https://api.github.com/users/sgmart/repos","events_url":"https://api.github.com/users/sgmart/events{/privacy}","received_events_url":"https://api.github.com/users/sgmart/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-01T13:21:33Z","updated_at":"2015-12-01T13:51:07Z","closed_at":null,"body":"Actually, I'm trying to save a tastypie model resource which contains a `TagField` from django-tagulous\r\n\r\nHere are my model, and resources:\r\n\r\n    # models.py\r\n    class SimpleModel(models.Model):\r\n        topics = tagulous.models.TagField()\r\n        title = models.CharField(max_length=100)\r\n\r\n\r\n    # resources.py\r\n    class TopicResource(ModelResource):\r\n        class Meta:\r\n            queryset = SimpleModel.topics.tag_model.objects.all()\r\n            authentication = Authentication()\r\n            authorization = Authorization()\r\n     \r\n\r\n    class SimpleModelResource(ModelResource):\r\n        tags = fields.ToManyField(TopicResource, attribute='topics', full=True, null=True)\r\n\r\n        class Meta:\r\n            queryset = SimpleModel.objects.all()\r\n            authentication = Authentication()\r\n            authorization = Authorization()\r\n\r\nthe curl part:\r\n\r\n    curl --request POST --dump-header - --header 'Content-Type: application/json' --data '{\"tags\": [\"/api/v1/topic/1/\"], \"title\": \"A bad dream\"}' localhost:8000/api/v1/simplemodel/\r\n\r\nThe shell doesn't return any error, however, the tags are not associated with the new object.\r\n\r\nBy overriding the `ModelResource save_m2m method`, before the `super` call the tag object is present (print bundle.data['tags']), then in the `super(SimpleModelResource, self).save_m2m(bundle)` tastypie looks for the related manager associated with the `tags` field, the `related_mngr` is returned but when it is evaluated using: `if not related_mngr` it evaluates to `True` spiking the m2m association.\r\n\r\nI'm sorry if it isn't an issue for this repository, I'm was not sure, and maybe it must be posted in the django-tastypie repository."},"comment":{"url":"https://api.github.com/repos/radiac/django-tagulous/issues/comments/160975516","html_url":"https://github.com/radiac/django-tagulous/issues/9#issuecomment-160975516","issue_url":"https://api.github.com/repos/radiac/django-tagulous/issues/9","id":160975516,"user":{"login":"radiac","id":241712,"avatar_url":"https://avatars.githubusercontent.com/u/241712?v=3","gravatar_id":"","url":"https://api.github.com/users/radiac","html_url":"https://github.com/radiac","followers_url":"https://api.github.com/users/radiac/followers","following_url":"https://api.github.com/users/radiac/following{/other_user}","gists_url":"https://api.github.com/users/radiac/gists{/gist_id}","starred_url":"https://api.github.com/users/radiac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/radiac/subscriptions","organizations_url":"https://api.github.com/users/radiac/orgs","repos_url":"https://api.github.com/users/radiac/repos","events_url":"https://api.github.com/users/radiac/events{/privacy}","received_events_url":"https://api.github.com/users/radiac/received_events","type":"User","site_admin":false},"created_at":"2015-12-01T13:51:07Z","updated_at":"2015-12-01T13:51:07Z","body":"Thanks for the detailed report! I think this is the best place for it at the moment - it would probably be best if we can figure out a way to fix it from within tagulous. I'll take a look at it asap to see if there's anything we can do."}}