diff --git a/amadeus/settings.py b/amadeus/settings.py index 30acb01..aae1913 100644 --- a/amadeus/settings.py +++ b/amadeus/settings.py @@ -42,6 +42,7 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', + 'django.contrib.postgres', 'widget_tweaks', 'rolepermissions', diff --git a/topics/forms.py b/topics/forms.py index 553db72..5608f26 100644 --- a/topics/forms.py +++ b/topics/forms.py @@ -18,7 +18,9 @@ class TopicForm(forms.ModelForm): name = self.cleaned_data.get('name', '') repo = self.cleaned_data.get('repository', False) - if len(self.subject.topic_subject.filter(name = name)) > 0: + same_name = len(self.subject.topic_subject.filter(name__unaccent__iexact = name)) + + if same_name > 0: if repo: self._errors['name'] = [_('This subject already has a repository')] else: diff --git a/topics/migrations/0003_auto_20170116_2101.py b/topics/migrations/0003_auto_20170116_2101.py new file mode 100644 index 0000000..fd5517f --- /dev/null +++ b/topics/migrations/0003_auto_20170116_2101.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10 on 2017-01-17 00:01 +from __future__ import unicode_literals + +from django.db import migrations + +from django.contrib.postgres.operations import UnaccentExtension + +class Migration(migrations.Migration): + + dependencies = [ + ('topics', '0002_auto_20170116_1841'), + ] + + operations = [ + UnaccentExtension() + ] \ No newline at end of file -- libgit2 0.21.2