Skip to content

Commit c07b39e

Browse files
committed
Merged in [8099] from rjsparks@nostrum.com:\n Use the name field from the materials upload form. Fixes ticket ietf-tools#1445.
- Legacy-Id: 8117 Note: SVN reference [8099] has been migrated to Git commit 4de405e
2 parents dac3efc + 4de405e commit c07b39e

2 files changed

Lines changed: 3 additions & 7 deletions

File tree

ietf/doc/tests_material.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ def test_upload_slides(self):
6565
test_file.seek(0)
6666

6767
# post
68-
r = self.client.post(url, dict(title="Test File",
68+
r = self.client.post(url, dict(title="Test File - with fancy title",
6969
name="slides-%s-test-file" % group.acronym,
7070
state=State.objects.get(type="slides", slug="active").pk,
7171
material=test_file))
7272
self.assertEqual(r.status_code, 302)
7373

7474
doc = Document.objects.get(name="slides-%s-test-file" % group.acronym)
7575
self.assertEqual(doc.rev, "00")
76-
self.assertEqual(doc.title, "Test File")
76+
self.assertEqual(doc.title, "Test File - with fancy title")
7777
self.assertEqual(doc.get_state_slug(), "active")
7878

7979
with open(os.path.join(self.materials_dir, "slides", doc.name + "-" + doc.rev + ".pdf")) as f:

ietf/doc/views_material.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from django.shortcuts import render, get_object_or_404, redirect
88
from django.http import HttpResponseForbidden, Http404
99
from django.utils.html import mark_safe
10-
from django.utils.text import slugify
1110
from django.contrib.auth.decorators import login_required
1211
from django.core.urlresolvers import reverse as urlreverse
1312

@@ -30,9 +29,6 @@ def choose_material_type(request, acronym):
3029
'material_types': DocTypeName.objects.filter(slug__in=group.features.material_types),
3130
})
3231

33-
def name_for_material(doc_type, group, title):
34-
return "%s-%s-%s" % (doc_type.slug, group.acronym, slugify(title))
35-
3632
class UploadMaterialForm(forms.Form):
3733
title = forms.CharField(max_length=Document._meta.get_field("title").max_length)
3834
name = forms.CharField(max_length=Document._meta.get_field("name").max_length)
@@ -112,7 +108,7 @@ def edit_material(request, name=None, acronym=None, action=None, doc_type=None):
112108
doc.type = document_type
113109
doc.group = group
114110
doc.rev = "00"
115-
doc.name = name_for_material(doc.type, doc.group, form.cleaned_data["title"])
111+
doc.name = form.cleaned_data["name"]
116112
prev_rev = None
117113
else:
118114
save_document_in_history(doc)

0 commit comments

Comments
 (0)