From 809705cceb4e7865408e99d2bf5a55757dade91e Mon Sep 17 00:00:00 2001 From: Zambom Date: Tue, 17 Jan 2017 18:53:58 -0200 Subject: [PATCH] Adjusting topic edit same name verification --- amadeus/static/js/topics.js | 2 ++ topics/forms.py | 5 ++++- topics/templates/topics/list.html | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/amadeus/static/js/topics.js b/amadeus/static/js/topics.js index c89cb5e..c7a3ccf 100644 --- a/amadeus/static/js/topics.js +++ b/amadeus/static/js/topics.js @@ -1,3 +1,4 @@ +// Update breadcrumb with topic's name $('.collapse').on('shown.bs.collapse', function (e) { if($(this).is(e.target)){ var li = $(".breadcrumb").find('li:last-child'); @@ -14,6 +15,7 @@ $('.collapse').on('shown.bs.collapse', function (e) { } }); +// Reset breadcrumb to it's normal state $('.collapse').on('hide.bs.collapse', function (e) { if($(this).is(e.target)){ $(".breadcrumb").find('li:last-child').remove(); diff --git a/topics/forms.py b/topics/forms.py index 5608f26..0ef8457 100644 --- a/topics/forms.py +++ b/topics/forms.py @@ -18,7 +18,10 @@ class TopicForm(forms.ModelForm): name = self.cleaned_data.get('name', '') repo = self.cleaned_data.get('repository', False) - same_name = len(self.subject.topic_subject.filter(name__unaccent__iexact = name)) + if self.instance.id: + same_name = len(self.subject.topic_subject.filter(name__unaccent__iexact = name).exclude(id = self.instance.id)) + else: + same_name = len(self.subject.topic_subject.filter(name__unaccent__iexact = name)) if same_name > 0: if repo: diff --git a/topics/templates/topics/list.html b/topics/templates/topics/list.html index b2c5b30..167c8a4 100644 --- a/topics/templates/topics/list.html +++ b/topics/templates/topics/list.html @@ -36,6 +36,10 @@
+ + {% autoescape off %} + {{ topic.description|default:_("Not Informed") }} + {% endautoescape %}
{% endif %} -- libgit2 0.21.2