diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index f8378da49..d0ca8a047 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -9,12 +9,14 @@ Changelog
* Added thousands separator for counters on dashboard
* Added contextual links to admin notification messages
* When copying pages, it is now possible to specify a place to copy to (Timo Rieber)
+ * FieldPanel now accepts an optional 'widget' parameter to override the field's default form widget (Alejandro Giacometti)
0.8.5 (xx.xx.20xx)
~~~~~~~~~~~~~~~~~~
* Fix: On adding a new page, the available page types are ordered by the displayed verbose name
* Fix: Active admin submenus were not properly closed when activating another
+* Fix: get_sitemap_urls is now called on the specific page class so it can now be overridden (Jerel Unruh)
0.8.4 (04.12.2014)
diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst
index 85654264d..dae2fd56e 100644
--- a/CONTRIBUTORS.rst
+++ b/CONTRIBUTORS.rst
@@ -38,6 +38,7 @@ Contributors
* Robert Rollins
* linibou
* Timo Rieber
+* Jerel Unruh
Translators
===========
diff --git a/docs/core_components/pages/editing_api.rst b/docs/core_components/pages/editing_api.rst
index 94bbb8e88..2087f8c87 100644
--- a/docs/core_components/pages/editing_api.rst
+++ b/docs/core_components/pages/editing_api.rst
@@ -23,8 +23,10 @@ A "panel" is the basic editing block in Wagtail. Wagtail will automatically pick
There are four basic types of panels:
- ``FieldPanel( field_name, classname=None )``
- This is the panel used for basic Django field types. ``field_name`` is the name of the class property used in your model definition. ``classname`` is a string of optional CSS classes given to the panel which are used in formatting and scripted interactivity. By default, panels are formatted as inset fields. The CSS class ``full`` can be used to format the panel so it covers the full width of the Wagtail page editor. The CSS class ``title`` can be used to mark a field as the source for auto-generated slug strings.
+ ``FieldPanel( field_name, classname=None, widget=None )``
+ This is the panel used for basic Django field types. ``field_name`` is the name of the class property used in your model definition. ``classname`` is a string of optional CSS classes given to the panel which are used in formatting and scripted interactivity. By default, panels are formatted as inset fields. The CSS class ``full`` can be used to format the panel so it covers the full width of the Wagtail page editor. The CSS class ``title`` can be used to mark a field as the source for auto-generated slug strings. The optional ``widget`` parameter allows you to specify a `django form widget`_ to use instead of the default widget for this field type.
+
+.. _django form widget: https://docs.djangoproject.com/en/dev/ref/forms/widgets/
``MultiFieldPanel( children, heading="", classname=None )``
This panel condenses several ``FieldPanel`` s or choosers, from a list or tuple, under a single ``heading`` string.
diff --git a/docs/releases/0.8.5.rst b/docs/releases/0.8.5.rst
index 447a68d33..9cb718254 100644
--- a/docs/releases/0.8.5.rst
+++ b/docs/releases/0.8.5.rst
@@ -15,3 +15,4 @@ Bug fixes
* On adding a new page, the available page types are ordered by the displayed verbose name
* Active admin submenus were not properly closed when activating another
+* ``get_sitemap_urls`` is now called on the specific page class so it can now be overridden
diff --git a/docs/releases/0.9.rst b/docs/releases/0.9.rst
index f70778bd3..c3b0f5c1d 100644
--- a/docs/releases/0.9.rst
+++ b/docs/releases/0.9.rst
@@ -18,6 +18,7 @@ Minor features
* Added thousands separator for counters on dashboard
* Added contextual links to admin notification messages
* When copying pages, it is now possible to specify a place to copy to
+ * ``FieldPanel`` now accepts an optional ``widget`` parameter to override the field's default form widget
Bug fixes
diff --git a/setup.py b/setup.py
index b5654c7cc..bd0f4de7f 100644
--- a/setup.py
+++ b/setup.py
@@ -40,6 +40,7 @@ install_requires = [
"Unidecode>=0.04.14",
"six>=1.7.0",
'requests>=2.0.0',
+ "Willow==0.1",
]
diff --git a/tox.ini b/tox.ini
index a01c890fe..df523d812 100644
--- a/tox.ini
+++ b/tox.ini
@@ -17,6 +17,7 @@ base =
python-dateutil==2.2
pytz==2014.7
Embedly
+ Willow==0.1
coverage
dj17 =
diff --git a/wagtail/contrib/wagtailsitemaps/sitemap_generator.py b/wagtail/contrib/wagtailsitemaps/sitemap_generator.py
index d22f88112..e5e43b03e 100644
--- a/wagtail/contrib/wagtailsitemaps/sitemap_generator.py
+++ b/wagtail/contrib/wagtailsitemaps/sitemap_generator.py
@@ -12,7 +12,7 @@ class Sitemap(object):
def get_urls(self):
for page in self.get_pages():
- for url in page.get_sitemap_urls():
+ for url in page.specific.get_sitemap_urls():
yield url
def render(self):
diff --git a/wagtail/contrib/wagtailsitemaps/tests.py b/wagtail/contrib/wagtailsitemaps/tests.py
index a556ce156..a2d0498d7 100644
--- a/wagtail/contrib/wagtailsitemaps/tests.py
+++ b/wagtail/contrib/wagtailsitemaps/tests.py
@@ -2,7 +2,7 @@ from django.test import TestCase
from django.core.cache import cache
from wagtail.wagtailcore.models import Page, PageViewRestriction, Site
-from wagtail.tests.models import SimplePage
+from wagtail.tests.models import SimplePage, EventIndex
from .sitemap_generator import Sitemap
@@ -47,6 +47,20 @@ class TestSitemapGenerator(TestCase):
self.assertIn('http://localhost/', urls) # Homepage
self.assertIn('http://localhost/hello-world/', urls) # Child page
+ def test_get_urls_uses_specific(self):
+ # Add an event page which has an extra url in the sitemap
+ events_page = self.home_page.add_child(instance=EventIndex(
+ title="Events",
+ slug='events',
+ live=True,
+ ))
+
+ sitemap = Sitemap(self.site)
+ urls = [url['location'] for url in sitemap.get_urls()]
+
+ self.assertIn('http://localhost/events/', urls) # Main view
+ self.assertIn('http://localhost/events/past/', urls) # Sub view
+
def test_render(self):
sitemap = Sitemap(self.site)
xml = sitemap.render()
diff --git a/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html b/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html
index 53697e82d..358bc71bd 100644
--- a/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html
+++ b/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html
@@ -230,6 +230,8 @@
Buttons
+
Buttons must have interaction possible (i.e be an input or button element) to get a suitable hover cursor
{% trans "Change document:" %}
{{ field }}
{% endblock %}
diff --git a/wagtail/wagtaildocs/templates/wagtaildocs/documents/_file_field_as_li.html b/wagtail/wagtaildocs/templates/wagtaildocs/documents/_file_field_as_li.html
new file mode 100644
index 000000000..0911fc998
--- /dev/null
+++ b/wagtail/wagtaildocs/templates/wagtaildocs/documents/_file_field_as_li.html
@@ -0,0 +1,4 @@
+{% load wagtailadmin_tags %}
+
+ {% include "wagtaildocs/documents/_file_field.html" %}
+
\ No newline at end of file
diff --git a/wagtail/wagtaildocs/templates/wagtaildocs/documents/edit.html b/wagtail/wagtaildocs/templates/wagtaildocs/documents/edit.html
index 62b9df514..9897b41eb 100644
--- a/wagtail/wagtaildocs/templates/wagtaildocs/documents/edit.html
+++ b/wagtail/wagtaildocs/templates/wagtaildocs/documents/edit.html
@@ -15,20 +15,32 @@
{% trans "Editing" as editing_str %}
{% include "wagtailadmin/shared/header.html" with title=editing_str subtitle=document.title icon="doc-full-inverse" usage_object=document %}
-
-
+
+
+
+
+
+
+
+ {% if document.file %}
+
{% trans "Filesize" %}
+
{{ document.file.size|filesizeformat }}
+ {% endif %}
+
+
+
diff --git a/wagtail/wagtailimages/models.py b/wagtail/wagtailimages/models.py
index 27eae6543..a544793fd 100644
--- a/wagtail/wagtailimages/models.py
+++ b/wagtail/wagtailimages/models.py
@@ -4,6 +4,7 @@ import re
from six import BytesIO, text_type
from taggit.managers import TaggableManager
+from willow.image import Image as WillowImage
from django.core.files import File
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
@@ -80,6 +81,19 @@ class AbstractImage(models.Model, TagSearchable):
def __str__(self):
return self.title
+ def get_willow_image(self):
+ try:
+ image_file = self.file.file # triggers a call to self.storage.open, so IOErrors from missing files will be raised at this point
+ except IOError as e:
+ # re-throw this as a SourceImageIOError so that calling code can distinguish
+ # these from IOErrors elsewhere in the process
+ raise SourceImageIOError(text_type(e))
+
+ image_file.open('rb')
+ image_file.seek(0)
+
+ return WillowImage.open(image_file)
+
def get_rect(self):
return Rect(0, 0, self.width, self.height)
diff --git a/wagtail/wagtailimages/templates/wagtailimages/images/_file_field.html b/wagtail/wagtailimages/templates/wagtailimages/images/_file_field.html
index ef61bdacb..4f1d62903 100644
--- a/wagtail/wagtailimages/templates/wagtailimages/images/_file_field.html
+++ b/wagtail/wagtailimages/templates/wagtailimages/images/_file_field.html
@@ -1,8 +1,10 @@
-{% extends "wagtailadmin/shared/field_as_li.html" %}
-{% load i18n %}
+{% extends "wagtailadmin/shared/field.html" %}
+{% load i18n wagtailimages_tags %}
{% block form_field %}
- {{ image.filename }}
+ {% image image original as original_image %}
- {% trans "Change image:" %}
+ {{ image.filename }} ({{ original_image.width }}x{{ original_image.height}})
+
+ {% trans "Change image file:" %}
{{ field }}
{% endblock %}
diff --git a/wagtail/wagtailimages/templates/wagtailimages/images/_file_field_as_li.html b/wagtail/wagtailimages/templates/wagtailimages/images/_file_field_as_li.html
new file mode 100644
index 000000000..bce019852
--- /dev/null
+++ b/wagtail/wagtailimages/templates/wagtailimages/images/_file_field_as_li.html
@@ -0,0 +1,4 @@
+{% load wagtailadmin_tags %}
+
+ {% include "wagtailimages/images/_file_field.html" %}
+
\ No newline at end of file
diff --git a/wagtail/wagtailimages/templates/wagtailimages/images/edit.html b/wagtail/wagtailimages/templates/wagtailimages/images/edit.html
index cd36f9f5c..dd31a1ba5 100644
--- a/wagtail/wagtailimages/templates/wagtailimages/images/edit.html
+++ b/wagtail/wagtailimages/templates/wagtailimages/images/edit.html
@@ -28,14 +28,14 @@
-
+
-
+
{% trans "Focal point (optional)" %}
{% trans "To define this image's most important region, drag a box over the image below." %} {% if image.focal_point %}({% trans "Current focal point shown" %}){% endif %}
@@ -64,10 +64,22 @@
-
+
+
+
{% if url_generator_enabled %}
{% trans "URL Generator" %}
+
{% endif %}
+
+ {% image image original as original_image %}
+
+