Using ContentTypes can lead to the awkward case where they are used
before the database is migrated, leading to errors on start up. Removing
ContentTypes and using plain Model classes instead makes this
impossible, and also makes the code clearer.
Fixes#2433
Currently, we only allow the following format for the serve view:
/images/<signature/<id>/<filter>/
This URL doesn't look nice as an image is expected to be a standalone file. This commit makes the following format possible:
/images/<signature/<id>/<filter>/test.jpg
Drone will now check that
from __future__ absolute_import, unicode_literals
is part of every Python source file, to ensure a consistent experience
across all versions of Python.
See #2392 for an instance where missing `unicode_literals` was causing
problems.
Add missing absolute_import, unicode_literals to all files
Explicitly ensure strings are of the correct types
Now that unicode_literals is in every file, some things that used to
be py2 `str`s were now `unicode` instead. This caused issues with
generated class / function names, which must be `str` in all versions of
Python. This means bytes in py2, and unicode in py3. A test also checked
for the incorrect type of SafeString. HTML content should always be
unicode, so this has been fixed.
The "icon-" prefix is automatically added in SettingMenuItem.
Using "icon-placeholder" as suggested would thus result in
the CSS class "icon-icon-placeholder".
Previously, the POST data could not be empty for some views, otherwise
they would not work. This caused the workarounds to be necessary. The
request method detection was fixed in the previous commit, so this
commit removes the workarounds.
Check `if request.method == 'POST':`, instead of `if request.POST:`. The
latter works as long as there is POST data, but on a delete form, for
example, there isn't any. It works fine usually, as the `csrf_token`
counts as POST data, and is included in all requests, but leads to
strange work arounds being required in tests.
These tests sent some Python 2 `str`s to unidecode via taggit, which
raised a RuntimeWarning. These strings should be unicode, and are
unicode when they come from Django outside of the tests.
unicode_literals should be added to all Python files to ensure
consistent handling of strings across Python versions, but that is a
larger and more controversial change.
Making developers opt out of extra security is better than making them
opt in, especially when they may not be aware of the security they are
missing out on.
Some code was using methods from Wagtail, even though those methods were
deprecated with alternatives provided. Those alternatives are now used
instead.
Forms for Page classes must subclass WagtailAdminPageForm. If they do
not, an error will be thrown for invalid arguments when the Page editor
is opened.
Partial fix for #2267.
Unless overridden by passing `base_form_class=CustomFormClass` to an
EditHandler, the EditHandler now gets the base form class from the
model. People who override the EditHandler of a model no longer have to
also override the base_form_class if the model needs a custom one.
Fixes#2267
Fixes#2369
The static() function was being called during app load which caused a crash when the user is using STATICFILES_STORAGE=ManifestStaticFilesStorage, DEBUG=False and haven't yet collected static files.
I've moved it into a property and it's now only called when a view is being rendered. This also is more consistent because we usually set media using properties (and so does Django admin).