Commit 809705cceb4e7865408e99d2bf5a55757dade91e
1 parent
e33fbf30
Exists in
master
and in
3 other branches
Adjusting topic edit same name verification
Showing
3 changed files
with
10 additions
and
1 deletions
Show diff stats
amadeus/static/js/topics.js
1 | +// Update breadcrumb with topic's name | |
1 | 2 | $('.collapse').on('shown.bs.collapse', function (e) { |
2 | 3 | if($(this).is(e.target)){ |
3 | 4 | var li = $(".breadcrumb").find('li:last-child'); |
... | ... | @@ -14,6 +15,7 @@ $('.collapse').on('shown.bs.collapse', function (e) { |
14 | 15 | } |
15 | 16 | }); |
16 | 17 | |
18 | +// Reset breadcrumb to it's normal state | |
17 | 19 | $('.collapse').on('hide.bs.collapse', function (e) { |
18 | 20 | if($(this).is(e.target)){ |
19 | 21 | $(".breadcrumb").find('li:last-child').remove(); | ... | ... |
topics/forms.py
... | ... | @@ -18,7 +18,10 @@ class TopicForm(forms.ModelForm): |
18 | 18 | name = self.cleaned_data.get('name', '') |
19 | 19 | repo = self.cleaned_data.get('repository', False) |
20 | 20 | |
21 | - same_name = len(self.subject.topic_subject.filter(name__unaccent__iexact = name)) | |
21 | + if self.instance.id: | |
22 | + same_name = len(self.subject.topic_subject.filter(name__unaccent__iexact = name).exclude(id = self.instance.id)) | |
23 | + else: | |
24 | + same_name = len(self.subject.topic_subject.filter(name__unaccent__iexact = name)) | |
22 | 25 | |
23 | 26 | if same_name > 0: |
24 | 27 | if repo: | ... | ... |
topics/templates/topics/list.html
... | ... | @@ -36,6 +36,10 @@ |
36 | 36 | <div id="{{topic.slug}}" class="panel-collapse collapse category-panel-content"> |
37 | 37 | <input type="hidden" class="id_inp" name="id" value="{{ topic.id }}" /> |
38 | 38 | <input type="hidden" class="order_inp" name="order" value="{{ topic.order }}" /> |
39 | + | |
40 | + {% autoescape off %} | |
41 | + {{ topic.description|default:_("Not Informed") }} | |
42 | + {% endautoescape %} | |
39 | 43 | </div> |
40 | 44 | </div> |
41 | 45 | {% endif %} | ... | ... |