| 1 | | You have an error in your code. You are mixing the `name` and `slug` fields, and it is actually complaining that there already exists a row in the Tag table with the empty string as a name. |
| 2 | | |
| 3 | | Here is something that works: |
| 4 | | |
| 5 | | {{{ |
| 6 | | tags = ['django', 'python', 'web', 'Django', 'html5', 'Python'] |
| 7 | | |
| 8 | | for tag in tags: |
| 9 | | obj, created = Tag.objects.get_or_create(name__iexact=tag, defaults={'slug': tag, 'name': tag}) |
| 10 | | print("Tag {0} created? {1}".format(obj.name, created) |
| 11 | | }}} |
| 12 | | |
| 13 | | You have to fill in both `name` and `slug` when you've decided to make both unique. |
| | 1 | Don't mind me, totally misread the issue :) |