0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +01:00

Removed type name from delete URL names

Was previously, delete_image, delete_document, etc. Now just "delete"
This commit is contained in:
Karl Hobley 2015-07-10 13:00:58 +01:00
parent 441314a19b
commit 8e11f4bce4
14 changed files with 17 additions and 17 deletions

View File

@ -6,7 +6,7 @@ urlpatterns = [
url(r'^$', documents.index, name='index'),
url(r'^add/$', documents.add, name='add'),
url(r'^edit/(\d+)/$', documents.edit, name='edit'),
url(r'^delete/(\d+)/$', documents.delete, name='delete_document'),
url(r'^delete/(\d+)/$', documents.delete, name='delete'),
url(r'^chooser/$', chooser.chooser, name='chooser'),
url(r'^chooser/(\d+)/$', chooser.document_chosen, name='document_chosen'),

View File

@ -8,7 +8,7 @@
<div class="nice-padding">
<p>{% trans "Are you sure you want to delete this document?" %}</p>
<form action="{% url 'wagtaildocs:delete_document' document.id %}" method="POST">
<form action="{% url 'wagtaildocs:delete' document.id %}" method="POST">
{% csrf_token %}
<input type="submit" value='{% trans "Yes, delete" %}' class="serious" />
</form>

View File

@ -28,7 +28,7 @@
{% include "wagtailadmin/shared/field_as_li.html" %}
{% endif %}
{% endfor %}
<li><input type="submit" value="{% trans 'Save' %}" /> <a href="{% url 'wagtaildocs:delete_document' document.id %}" class="button button-secondary no">{% trans "Delete document" %}</a></li>
<li><input type="submit" value="{% trans 'Save' %}" /> <a href="{% url 'wagtaildocs:delete' document.id %}" class="button button-secondary no">{% trans "Delete document" %}</a></li>
</ul>
</form>
</div>

View File

@ -205,7 +205,7 @@ class TestDocumentDeleteView(TestCase, WagtailTestUtils):
self.document = models.Document.objects.create(title="Test document")
def test_simple(self):
response = self.client.get(reverse('wagtaildocs:delete_document', args=(self.document.id,)))
response = self.client.get(reverse('wagtaildocs:delete', args=(self.document.id,)))
self.assertEqual(response.status_code, 200)
self.assertTemplateUsed(response, 'wagtaildocs/documents/confirm_delete.html')
@ -214,7 +214,7 @@ class TestDocumentDeleteView(TestCase, WagtailTestUtils):
post_data = {
'foo': 'bar'
}
response = self.client.post(reverse('wagtaildocs:delete_document', args=(self.document.id,)), post_data)
response = self.client.post(reverse('wagtaildocs:delete', args=(self.document.id,)), post_data)
# User should be redirected back to the index
self.assertRedirects(response, reverse('wagtaildocs:index'))

View File

@ -145,7 +145,7 @@ def edit(request, document_id):
if not filesize:
messages.error(request, _("The file could not be found. Please change the source or delete the document"), buttons=[
messages.button(reverse('wagtaildocs:delete_document', args=(doc.id,)), _('Delete'))
messages.button(reverse('wagtaildocs:delete', args=(doc.id,)), _('Delete'))
])
return render(request, "wagtaildocs/documents/edit.html", {

View File

@ -6,7 +6,7 @@ from wagtail.wagtailimages.views import images, chooser, multiple
urlpatterns = [
url(r'^$', images.index, name='index'),
url(r'^(\d+)/$', images.edit, name='edit'),
url(r'^(\d+)/delete/$', images.delete, name='delete_image'),
url(r'^(\d+)/delete/$', images.delete, name='delete'),
url(r'^(\d+)/generate_url/$', images.url_generator, name='url_generator'),
url(r'^(\d+)/generate_url/(.*)/$', images.generate_url, name='generate_url'),
url(r'^(\d+)/preview/(.*)/$', images.preview, name='preview'),

View File

@ -14,7 +14,7 @@
</div>
<div class="col6">
<p>{% trans "Are you sure you want to delete this image?" %}</p>
<form action="{% url 'wagtailimages:delete_image' image.id %}" method="POST">
<form action="{% url 'wagtailimages:delete' image.id %}" method="POST">
{% csrf_token %}
<input type="submit" value="{% trans 'Yes, delete' %}" class="serious" />
</form>

View File

@ -42,7 +42,7 @@
{% endif %}
{% endfor %}
<li><input type="submit" value="{% trans 'Save' %}" /><a href="{% url 'wagtailimages:delete_image' image.id %}" class="button button-secondary no">{% trans "Delete image" %}</a></li>
<li><input type="submit" value="{% trans 'Save' %}" /><a href="{% url 'wagtailimages:delete' image.id %}" class="button button-secondary no">{% trans "Delete image" %}</a></li>
</ul>
</form>
</div>

View File

@ -192,10 +192,10 @@ class TestImageDeleteView(TestCase, WagtailTestUtils):
)
def get(self, params={}):
return self.client.get(reverse('wagtailimages:delete_image', args=(self.image.id,)), params)
return self.client.get(reverse('wagtailimages:delete', args=(self.image.id,)), params)
def post(self, post_data={}):
return self.client.post(reverse('wagtailimages:delete_image', args=(self.image.id,)), post_data)
return self.client.post(reverse('wagtailimages:delete', args=(self.image.id,)), post_data)
def test_simple(self):
response = self.get()

View File

@ -133,7 +133,7 @@ def edit(request, image_id):
# Give error if image file doesn't exist
if not os.path.isfile(local_path):
messages.error(request, _("The source image file could not be found. Please change the source or delete the image.").format(image.title), buttons=[
messages.button(reverse('wagtailimages:delete_image', args=(image.id,)), _('Delete'))
messages.button(reverse('wagtailimages:delete', args=(image.id,)), _('Delete'))
])
return render(request, "wagtailimages/images/edit.html", {

View File

@ -8,7 +8,7 @@
<div class="row row-flush nice-padding">
<p>{% trans "Are you sure you want to delete this redirect?" %}</p>
<form action="{% url 'wagtailredirects:delete_redirect' redirect.id %}" method="POST">
<form action="{% url 'wagtailredirects:delete' redirect.id %}" method="POST">
{% csrf_token %}
<input type="submit" value="{% trans 'Yes, delete' %}" class="serious" />
</form>

View File

@ -12,7 +12,7 @@
<div>
<input type="submit" value="{% trans 'Save' %}" />
<a href="{% url 'wagtailredirects:delete_redirect' redirect.id %}" class="button button-secondary no">{% trans "Delete redirect" %}</a>
<a href="{% url 'wagtailredirects:delete' redirect.id %}" class="button button-secondary no">{% trans "Delete redirect" %}</a>
</div>
</form>

View File

@ -189,10 +189,10 @@ class TestRedirectsDeleteView(TestCase, WagtailTestUtils):
self.login()
def get(self, params={}, redirect_id=None):
return self.client.get(reverse('wagtailredirects:delete_redirect', args=(redirect_id or self.redirect.id, )), params)
return self.client.get(reverse('wagtailredirects:delete', args=(redirect_id or self.redirect.id, )), params)
def post(self, post_data={}, redirect_id=None):
return self.client.post(reverse('wagtailredirects:delete_redirect', args=(redirect_id or self.redirect.id, )), post_data)
return self.client.post(reverse('wagtailredirects:delete', args=(redirect_id or self.redirect.id, )), post_data)
def test_simple(self):
response = self.get()

View File

@ -6,5 +6,5 @@ urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^add/$', views.add, name='add'),
url(r'^(\d+)/$', views.edit, name='edit'),
url(r'^(\d+)/delete/$', views.delete, name='delete_redirect'),
url(r'^(\d+)/delete/$', views.delete, name='delete'),
]