{"action":"created","issue":{"url":"https://api.github.com/repos/django-import-export/django-import-export/issues/257","labels_url":"https://api.github.com/repos/django-import-export/django-import-export/issues/257/labels{/name}","comments_url":"https://api.github.com/repos/django-import-export/django-import-export/issues/257/comments","events_url":"https://api.github.com/repos/django-import-export/django-import-export/issues/257/events","html_url":"https://github.com/django-import-export/django-import-export/issues/257","id":73361914,"number":257,"title":"unique_together doesn't work","user":{"login":"cfarfan","id":1527222,"avatar_url":"https://avatars.githubusercontent.com/u/1527222?v=3","gravatar_id":"","url":"https://api.github.com/users/cfarfan","html_url":"https://github.com/cfarfan","followers_url":"https://api.github.com/users/cfarfan/followers","following_url":"https://api.github.com/users/cfarfan/following{/other_user}","gists_url":"https://api.github.com/users/cfarfan/gists{/gist_id}","starred_url":"https://api.github.com/users/cfarfan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfarfan/subscriptions","organizations_url":"https://api.github.com/users/cfarfan/orgs","repos_url":"https://api.github.com/users/cfarfan/repos","events_url":"https://api.github.com/users/cfarfan/events{/privacy}","received_events_url":"https://api.github.com/users/cfarfan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-05-05T16:28:37Z","updated_at":"2015-06-20T07:54:39Z","closed_at":null,"body":"Hello!\r\nI have the following code:\r\n\r\nmodels.py\r\n```\r\nclass Fulfillment(models.Model):\r\n\tpercentage \t= models.FloatField()\r\n\tmonth \t\t= models.ForeignKey(Month)\r\n\tyear \t\t= models.ForeignKey(Year)\r\n\tcompany \t        = models.ForeignKey(Company)\r\n\tcountry \t        = models.ForeignKey(Country)\r\n\tclass Meta:\r\n\t\tverbose_name \t\t= 'Budget Fulfillment'\r\n\t\tverbose_name_plural = 'Budget Fulfillments'\r\n\t\tget_latest_by \t\t= 'year'\r\n\t\tunique_together \t= (('company','country','year', 'month'),)\r\n```\r\nadmin.py\r\n```\r\nclass FulfillmentResource(resources.ModelResource):\r\n\tcompany = fields.Field(column_name='company', attribute='company',widget=widgets.ForeignKeyWidget(Company,'name') )\r\n\tcountry = fields.Field(column_name='country', attribute='country',widget=widgets.ForeignKeyWidget(Country,'name') )\r\n\tclass Meta:\r\n\t\tmodel = Fulfillment\r\n\t\tfields = ('id','company','country','year','month','percentage')\r\n\t\texport_order = ('id','company','country','year','month','percentage')\r\n````\r\nso, when I import a xls with the duplicate data, unique_together does not work (the duplicate data is added to database).\r\ncan you help me with this?"},"comment":{"url":"https://api.github.com/repos/django-import-export/django-import-export/issues/comments/113726167","html_url":"https://github.com/django-import-export/django-import-export/issues/257#issuecomment-113726167","issue_url":"https://api.github.com/repos/django-import-export/django-import-export/issues/257","id":113726167,"user":{"login":"manelclos","id":463832,"avatar_url":"https://avatars.githubusercontent.com/u/463832?v=3","gravatar_id":"","url":"https://api.github.com/users/manelclos","html_url":"https://github.com/manelclos","followers_url":"https://api.github.com/users/manelclos/followers","following_url":"https://api.github.com/users/manelclos/following{/other_user}","gists_url":"https://api.github.com/users/manelclos/gists{/gist_id}","starred_url":"https://api.github.com/users/manelclos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manelclos/subscriptions","organizations_url":"https://api.github.com/users/manelclos/orgs","repos_url":"https://api.github.com/users/manelclos/repos","events_url":"https://api.github.com/users/manelclos/events{/privacy}","received_events_url":"https://api.github.com/users/manelclos/received_events","type":"User","site_admin":false},"created_at":"2015-06-20T07:54:39Z","updated_at":"2015-06-20T07:54:39Z","body":"Hi @cfarfan, @bmihelac is right, you should be getting a database error. Anyway, try setting the ``import_id_fields`` option in the resource to your unique_together fields, and see if it helps. See here: https://django-import-export.readthedocs.org/en/latest/getting_started.html#customize-resource-options\r\n"}}