0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-29 17:36:49 +01:00
Commit Graph

87 Commits

Author SHA1 Message Date
Matt Westcott
4a5f3072bd Release note and docs for #3315 2017-08-01 00:17:02 +01:00
Jeffrey Chau
988a2487ef Update documentation to reflect specific behavior of form_classname meta attribute 2017-07-28 15:41:38 +01:00
Andreas Nüßlein
bfd4a2ef4b Adding the Meta attribute group to Blocks.
The idea is that Streamfield-Blocks can be grouped in the CMS
by setting Meta's `group` attribute.
This gives a better overview, particularly with many blocks.
If the attribute remains unset, nothing changes.
2017-04-10 20:27:32 +01:00
Matt Westcott
6d553ab396 Document that 'format' on Date(Time)Block must be one of the recognised DATE(TIME)_INPUT_FORMATS 2017-03-31 16:46:00 +01:00
Bojan Mihelac
0f53afc5a6 Adds support for custom date and datetime formats (#2595)
It is possible to set default format for date/datetime inputs. This works together
with standard django localization.

    # django settings
    USE_I18N = True
    LANGUAGE_CODE = 'sl'

    # wagtail settings
    WAGTAIL_DATE_FORMAT = '%d.%m.%Y.'
    WAGTAIL_DATETIME_FORMAT = '%d.%m.%Y. %H:%M'

DateBlock, DateTimeBlock accepts additional keyword argument `format`.
2017-03-31 16:30:27 +01:00
Nick Smith
48949e69a7 Add to StreamField migrations documentation
- Add example code for migrating draft pages and page revisions
2017-03-30 21:37:12 +01:00
Mikalai Radchuk
eb47526888 Enhancement for PageChooserBlock
Allow the target_model argument to be a list or tuple.
2017-02-17 11:30:32 +00:00
Matt Westcott
19310a84ed Documentation and release notes for #3275 2017-01-16 18:51:42 +00:00
Mikela Clemmons
26b7071307 RegexBlock error_message typo in docs
In the documention an example had a singular
2017-01-13 10:06:19 +00:00
J. Heasly
9424a8eab9 Give indication that there may be other template bits necessary for tag to work.
I came to this page from "Getting Started" template examples where all pages examples are rendered within {% block content %} tags which are not in these template examples."
;
2017-01-05 10:14:07 +00:00
Scot Hacker
2882775842 Add BlockQuoteBlock to core block types 2016-11-29 10:13:10 +00:00
Mikalai Radchuk
55bdae573b Add support of callable choices for ChoiceBlock
Fixes #2809
2016-11-28 17:44:35 +00:00
Benoit Vogel
2fba07ad8e Implemented StaticBlock
Uses admin_text which is a Meta attribute.
* StaticBlock code in wagtailcore/blocks + tests
* StaticBlock in Streamfield docs
2016-11-15 10:29:06 +00:00
Tim Heap
9d54031a50 Add PageChooserBlock target_model option
It allows selecting a restricted subset of pages, like with the
PageChooserPanel
2016-10-26 13:01:46 +01:00
David Burke
db54a9f0c4 Update IntegerBlock docs to show correct kwargs (#2930)
It should be max and min value - not length. See [here](07c3ba84fb/wagtail/wagtailcore/blocks/field_block.py (L306)).

So this would work 

`blocks.IntegerBlock(max_value=10, min_value=0)`

but this wouldn't do anything

`blocks.IntegerBlock(max_length=10, min_length=0)`
2016-08-20 02:38:00 +01:00
Matt Westcott
bc7739e104 Add usage examples for EmailBlock, IntegerBlock, DecimalBlock
Thanks to @OktayAltay for the original pull request.
2016-08-08 20:15:45 +01:00
Matt Westcott
be1e1927c5 Promote include_block and unicode page slugs to major features 2016-07-07 11:20:43 +01:00
Matt Westcott
dbc4c9b28e Adds the include_block template tag (#2786)
Update render and render_basic methods on Block to take a context kwarg

Update TableBlock to support passing extra context to render

Implement render_as_block on BoundBlock, StreamValue and StructValue.

Collectively, these are the objects encountered during template rendering which typically render
a block template when output inside {{ ... }} tags. Implementing render_as_block allows us to do
the same thing, but passing a template context as well.

Implement include_block tag

Support extra context vars on include_block via 'with foo=bar'

Support 'only' flag on include_block tag, to omit the parent context

Update StreamField documentation to cover the include_block tag

Rewrite 'BoundBlocks and values' docs based on the include_block tag

Add tests for blocks with legacy render / render_basic methods

Any bits of StreamField infrastructure that attempt to call render or render_basic
on a block with a 'context' kwarg, should (for now) also work on blocks that don't
accept the context kwarg, but output a RemovedInWagtail18Warning.

Explicitly test whether render / render_basic will accept a 'context' kwarg

This avoids unexpected behaviour when the method legitimately accepts a context
kwarg, but happens to throw an unrelated TypeError - in this situation, the final
output (or error diagnostics) will behave as if the context was never passed,
making debugging difficult. See https://github.com/torchbox/wagtail/pull/2786#discussion_r69563984
2016-07-06 17:44:02 +03:00
Matt Westcott
9961455c6a Add formal support for customising the form rendering of StructBlocks
The `form_template` attribute was mentioned in passing in the docs, but was missing various things
to make it fully useful:

- context passed to form_template now includes 'prefix' and 'block_definition'
- context for the form is now populated in a separate overrideable `get_form_context` method
- full documentation and tests for form_template and get_form_context added
2016-07-05 11:48:09 +01:00
Matt Westcott
5758b54f2e Support error_messages dict as argument to RegexBlock
The individual `error_message` kwarg on RegexField is deprecated in Django 1.8
(and removed in Django 1.10), so it's appropriate for RegexBlock to follow the
same convention.
2016-06-28 16:11:52 +01:00
OktayAltay
9358e3b611 Add new FloatBlock, DecimalBlock and a RegexBlock (#2737) 2016-06-23 10:14:28 +01:00
Oktay Altay
31ce2e802c Add new EmailBlock and IntegerBlock 2016-06-17 23:39:49 +01:00
Robert Rollins
11793f88c5 Changed indentation on all code samples to 4 spaces.
Most of the samples were already 4-space indented, but a few were using 2-space,
which is both inconsistent and, when it happened with Python code samples,
incompatible with PEP8.
2016-04-28 10:57:22 +01:00
Robert Rollins
6446c42132 Various typo fixes and grammar/clarity improvements. 2016-03-10 15:11:41 +00:00
Matt Westcott
04fdd5f352 Remove Django 1.7 support from documentation, requirements and CI definitions 2016-01-05 17:38:29 +00:00
Matt Westcott
9e124cb9b6 Remove use of value.bound_blocks from basic StructBlock template example.
This hasn't been necessary since #1360 was merged, and the new 'BoundBlocks and values' section covers it much better.
2015-12-11 12:48:37 +00:00
Matt Westcott
0e34282646 Add section about BoundBlocks and values 2015-12-11 12:48:37 +00:00
Rich Brennan
2ad3985d67 Move content_panels inside BlogPage definition. 2015-11-19 17:16:02 +00:00
Matt Westcott
f668922893 Add a can_choose_root flag to PageChooserBlock 2015-11-02 15:12:42 +00:00
Matt Westcott
2eb4b4c2c1 Release notes for #1810, #1835, #1812 2015-10-20 11:16:09 +01:00
Karl Hobley
26889ba128 Merge pull request #1812 from gasman/feature/block-template-context
Allow block subclasses to pass extra context variables to templates
2015-10-19 09:29:59 +01:00
Karl Hobley
6eae465e64 Renamed "self" template variable to "page" in docs 2015-10-13 09:52:16 +01:00
Matt Westcott
46845112e2 Allow block subclasses to pass extra context variables to templates
Block now defines a get_context method, which subclasses can override
in the same way as we can for pages.
2015-10-12 13:25:56 +01:00
Tim Heap
bc6b5a8a6c Normalise all code blocks in the docs
All `.. code::` instances have been changed to use `.. code-block::`,
and have been properly formatted. The syntax names have been normalised,
so all django templates use the `html+django` syntax, shell commands use
`sh`, and plain text uses `text`.
2015-10-05 16:55:58 +01:00
Matt Westcott
8bd6d65a20 Support overriding form classname and template within StructBlock 2015-06-16 13:09:33 +01:00
Matt Westcott
fddeb4308b Documentation for migrating a RichTextField to StreamField 2015-06-12 20:33:19 +01:00
Karl Hobley
2e0dcc88d5 Moved some of the reference docs into topics 2015-05-28 12:57:00 +01:00