Commit graph

5685 commits

Author SHA1 Message Date
Karl Hobley
df26c8de80 Added missing attributes to generic class based views
This lets us pass them as arguments to .as_view()
2016-01-27 11:19:09 +00:00
Karl Hobley
61593d38ad Changelog/release note/contributor for #2153 2016-01-27 11:16:02 +00:00
Josh Schneier
941d3bec17 Fixes #2120 - bail out of RedirectMiddleware if request.site is not set 2016-01-27 11:12:13 +00:00
Karl Hobley
827ead12c2 Add on_delete=CASCADE to all ForeignKeys without on_delete action
Defining ForeignKeys/OneToOneFields without an on_delete action is deprecated in Django 1.9.

This commit adds on_delete=CASCADE to every ForeignKey that doesn't yet have an on_delete action.
2016-01-26 17:28:49 +00:00
Karl Hobley
8ef846d214 Set on_delete action to SET_NULL on Document.uploaded_by_user
This prevents deletion of users from deleting any Documents they have uploaded.

This is already the behaviour on images.
2016-01-26 17:13:57 +00:00
Karl Hobley
b70823f2aa refactor(search/elastic): cleanup AtomicRebuilder.finish() method 2016-01-26 16:50:16 +00:00
Karl Hobley
27f50a527c refactor(search/elastic): Removed CRUD methods from rebuilder classes
The .start() method now returns an ElasticSearchIndex object that you should perform CRUD operations against instead

This commit removes a nice test that will be reintroduced later
2016-01-26 16:50:16 +00:00
Karl Hobley
4441232fe3 refactor(search/elastic): Added ElasticSearchIndex class
This class represents an individual index in Elasticsearch.

This commit also refactors duplicated implementations of the CRUD methods for updating documents and mappings in the database. These now all live in the new index class.
2016-01-26 16:50:16 +00:00
Karl Hobley
c08f5b76a5 refactor(search/elastic): Moved INDEX_SETTINGS to ElasticSearch.settings 2016-01-26 16:50:15 +00:00
Karl Hobley
ba14487793 refactor(search/elastic): Lowercase type_map 2016-01-26 16:50:15 +00:00
Karl Hobley
6982a1f20a refactor(search/elastic): Renamed attributes of ElasticSearch 2016-01-26 16:50:15 +00:00
Karl Hobley
e93ee241c2 docs(search/elastic): Fix capitalisation of Elasticsearch 2016-01-26 16:50:14 +00:00
Karl Hobley
9751e00c92 tests(search/elastic): Use swappable class names in tests 2016-01-26 16:50:14 +00:00
Karl Hobley
3bcb722a5f refactor(search/elastic): Allow rebuilder classes to be swapped 2016-01-26 16:50:14 +00:00
Karl Hobley
ee10c18552 refactor(search/elastic): Allow mapping class to be swapped 2016-01-26 16:50:14 +00:00
Karl Hobley
45d8db71a0 refactor(search/elastic): Rebuilders now take index in __init__ 2016-01-26 16:50:14 +00:00
Karl Hobley
3e218c4f96 refactor(search/backends): Removed search_ prefix from attributes 2016-01-26 16:50:14 +00:00
Chris Rogers
d754bac9bb Changed success message for when a page is published with go_live_at 2016-01-26 10:31:38 +00:00
Tim Heap
66da5ad5ad Remove double tagit initialisation
tagit was initialized from both the AdminTagWidget, and from the `done`
method in the image uploader. Initializing it twice led to strange
errors and ultimately the tags not being saved on the image model.

As the tag widget now contains its own initialisation <script>, tag
inputs do not need to be specially handled by AJAX code any more, so
this can simply be removed.

Fixes #2142
2016-01-25 18:56:11 +00:00
Karl Hobley
d68f4829c4 Allow importing embed finders by module 2016-01-25 18:11:01 +00:00
Karl Hobley
878975b1b8 Refactor get_default_finder to work without importing finders 2016-01-25 18:11:01 +00:00
Karl Hobley
5535e947a0 Tests for get_default_finder 2016-01-25 18:11:01 +00:00
Karl Hobley
12b8c60a8f Remap old embed paths to new ones
For backwards compatibility
2016-01-25 18:11:01 +00:00
Karl Hobley
43b6545a5a Moved get_default_finder into finders module 2016-01-25 18:11:01 +00:00
Karl Hobley
40778b538d Moved embed finders into separate modules 2016-01-25 18:11:01 +00:00
Matt Westcott
8afe69fd72 Release note for #1867 2016-01-25 15:30:18 +00:00
Tim Heap
417cafe69b Add @cached_classmethod, use instead of @classmethod/@lru_cache 2016-01-25 14:18:49 +00:00
Tim Heap
5714a6a3ab Set base_form_class for SimplePage.edit_handler 2016-01-25 14:18:49 +00:00
Tim Heap
077cd6eda8 Add checks for bad forms from Page EditHandlers
Page EditHandlers must return a subclass of WagtailAdminPageForm to work
correctly. A check has been added to ensure this is the case, raising an
error on startup otherwise.
2016-01-25 14:18:48 +00:00
Tim Heap
eda5b86bee Add tests for custom page form classes 2016-01-25 14:18:48 +00:00
Tim Heap
83d8c1a50e Move page validation to WagtailAdminPageForm class
Page validation is now done through the WagtailAdminPageForm class,
instead of through a separate function.
2016-01-25 14:18:48 +00:00
Tim Heap
8bb6982175 Allow Pages to use a custom form for validation
The form class assigned to a MyPage.base_form_class will be used to
validate MyPage instances when editing them in the admin.
2016-01-25 14:18:48 +00:00
Tim Heap
92d507752f Allow overriding base form class for EditHandlers
EditHandlers that can produce forms can now specify which base form
class to use. This defaults to WagtailAdminModelForm, which was the hard
coded base class previously.

Only TabbedInterface and ObjectList EditHandlers now support generating
a form. Other EditHandlers generating forms was not used anywhere except
in the tests.
2016-01-25 14:18:48 +00:00
Matt Westcott
73b6ba01a5 Port wagtailimages to OwnershipPermissionPolicy 2016-01-25 09:58:00 +00:00
Matt Westcott
b51f8ce338 Port wagtaildocs to use OwnershipPermissionPolicy 2016-01-25 09:58:00 +00:00
Matt Westcott
04307e05b1 Port generic admin views (and thus wagtailsites) to use permission policies 2016-01-25 09:58:00 +00:00
Matt Westcott
56181cf601 Port wagtailredirects to the permission policy mechanism.
A new helper class in wagtailadmin.utils, PermissionPolicyChecker, is added to provide permission check decorators for the admin views. (This is out of scope for the wagtailcore.permissions module, because it depends on wagtailadmin to supply the 'permission denied' response.)

Not currently implemented - disabling the edit links on the index page listing, for users without change permission. To do this efficiently (and within the constraints of Django templating), we'd need to implement a user/instance-specific lookup object, as we do for pages.
2016-01-25 09:58:00 +00:00
Matt Westcott
87b7cbd596 Implement permission policy modules: BlanketPermissionPolicy, AuthenticationOnlyPermissionPolicy, ModelPermissionPolicy, OwnershipPermissionPolicy
These modules allow all permission logic ('can user X do Y', 'can user X do Y on instance Z', 'who are the users who can do Y on instance Z') to be moved into a single module that can be potentially swapped out to provide new permission rules without changing the rest of the code.
2016-01-25 09:58:00 +00:00
Matt Westcott
3e5c665014 Fix CustomUserManager._create_user to allow passing is_active=False 2016-01-25 09:58:00 +00:00
Matt Westcott
097f45f20b Fix Page model recipes to pass 'self' as the page object ('page' is undefined) 2016-01-22 11:24:41 +00:00
Tim Heap
b7fd5de8ec Add test for failing StreamBlock validation 2016-01-21 17:36:52 +00:00
Tim Heap
968676c5bb Use a dictionary for StreamField errors
Instead of filling an array with `None` to indicate no errors, a
dictionary is only set when there is an actual error. This will allow
future functionality for errors to be added to the StreamField itself,
rather than a block, similar to adding errors to a form rather than a
specific field.
2016-01-21 17:36:52 +00:00
Matt
e0a7a472e6 Clarify what the Administrator flag does 2016-01-21 12:48:34 +00:00
Karl Hobley
2225faae97 Pin Django modelcluster to 1.1
Prevents possibly incompatible versions from being automatically installed in the future.
2016-01-21 11:35:19 +00:00
Karl Hobley
ec59c33ce5 Changelog/release note/contributor for #2134 2016-01-21 11:26:19 +00:00
Josh Hurd
a96db0e30b Fix Wistia oembed regex pattern 2016-01-21 11:24:18 +00:00
Matt Westcott
88078ac389 Reorder INSTALLED_APPS to put most specific apps first 2016-01-21 10:18:48 +00:00
Matt Westcott
7c211e7ec0 Update settings in 'configuring Django' docs for Django 1.9 2016-01-20 20:11:40 +00:00
Peter Quade
5c0063f429 making datetimepicker aware of FIRST_DAY_OF_WEEK 2016-01-20 16:30:22 +00:00
alexpilot11
5270c14444 ChooserBlock should use pk instead of id 2016-01-20 12:12:27 +00:00