Wykres commitów

109 Commity (7bc819640d7aad0e968260df4b57591120da00f3)

Autor SHA1 Wiadomość Data
Matt Westcott 7bc819640d Restore PageManager behaviour by setting it on an abstract superclass of Page
Django's standard behaviour is to preserve managers that are set on abstract
superclasses, so this allows us to eliminate the metaclass hackery.

Fixes #2933
2016-08-23 20:12:22 +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
Nik Nyby 389317c104 docs: fix typo (#2845) 2016-07-15 21:58:47 +03: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
Gagaro 871a5b5d9c Use python_2_unicode_compatible in snippets.rst (#2688)
We should use `python_2_unicode_compatible` in the documentation so that new users know the best practice.
2016-06-07 13:49:28 +01:00
Josh Schneier 6d1a9efbb6 Update documentation and code to put mixin first 2016-05-04 14:05:33 +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
João Luiz Lorencetti ffbe4730f0 The destination of the ParentalKey should be a subclass of ClusterableModel 2016-04-03 20:18:57 +01:00
Timo Rieber 9bdc843c8f Clarified wagtail userbar options and positioning 2016-03-27 14:23:47 +01:00
Tim Heap 6bd168580e Change Indexed.search_fields to be a listish thing
Indexed.search_fields used to be a tuple. This is incorrect, and it
should have been a list.  Changing it to be a list now would be a
backwards incompatible change, as people do

    search_fields = Page.search_fields + (
        SearchField('body')
    )

Adding a tuple to the end of a list causes an error, so this would
cause all old code that used tuples to throw an error. This is not
great.

A new ThisShouldBeAList class, which subclasses list, has been added.
It additionally allows tuples to be added to it, as in the above
behaviour, but will raise a deprecation warning if someone does this.
Old code that uses tuples will continue to work, but raise a deprecation
warning.

See #2310
2016-03-24 21:05:09 +00:00
Robert Rollins b94ff6a952 Searchly no longer supports Elasticsearch 1.x, so I switched the suggested development service to Bonsai. 2016-03-10 15:11:42 +00:00
Robert Rollins 6446c42132 Various typo fixes and grammar/clarity improvements. 2016-03-10 15:11:41 +00:00
Loïc Teixeira 33aad3957f Fix internal links with anchors
Generating links with `link text <./path/to/doc#anchor>`__ does not work for html.
It produces a link to `./path/to/doc#anchor` instead of `./path/to/doc.html#anchor`.

It would be tempting to add `.html` before `#` but would likely cause some more issues
when generating the documentation as pdf or epub.

References on the other hand will work regardless of the output format.
2016-03-06 21:05:05 +00:00
Matt Westcott 49e2de9813 fix doc rendering error in wagtailuserbar code block 2016-03-06 21:02:51 +00:00
Josh Barr a1a2940495 fixed font size rounding issue in firefox, added contrib notes 2016-03-03 12:29:28 +13:00
Quadric d27df01815 Tagging snippets documentation fix
I'm not sure i'm right but i think there is a typo in this example. I guess there should be a AdvertTag use in TaggableManager instead BlogPageTag
2016-02-12 11:11:08 +00:00
Andrew Pryde e2601c30b8 Fix PageQuerySet code overriding code snippet 2016-02-08 16:03:11 +03:00
Karl Hobley 95ff74feeb Moved advanced image topics into advanced topics 2016-01-27 11:27:16 +00:00
Karl Hobley 8a9e65f92f Change title of "topics" section to "Usage guide" 2016-01-27 11:27:16 +00:00
Matt Westcott 04fdd5f352 Remove Django 1.7 support from documentation, requirements and CI definitions 2016-01-05 17:38:29 +00:00
Denis Voskvitsov ab45915a90 Set `request.is_preview` flag to show whether page is served as preview 2015-12-16 11:28:53 +00:00
Tim Heap 9e8c2c2d5f Allow custom Page Managers
Previously, if a developer wanted to use a custom Manager on their Page
subclass, some fairly hacky hacks were required. Now, the `objects`
attribute is only overridden if it is a plain `Manager`. If it is
anything else, it is left alone. A system check has been added to ensure
that all `Page` managers inherit from `PageManager`
2015-12-14 23:09:45 +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
Matt Westcott 2c765a7462 Release note for #1491 2015-12-11 12:46:01 +00:00
Karl Hobley eed5c60d72 Docs for index.RelatedFields 2015-12-11 12:29:27 +00:00
Maris Serzans 32b4124767 Changed verbose names to start with lowercase when necessary 2015-12-08 17:33:19 +00:00
Jan Korte 56cfe02bae snippet docs: loading the tags is necessary 2015-12-03 18:45:29 +00:00
Tim Heap f4968de0f9 Allow overriding attributes in {% image %} tag
The `alt` attribute that was automatically generated as part of the
`{% image %}` tag could not be overridden. If template authors passed
their own `alt="..."` attribute in, two would be printed out instead
of the default one being overridden.

The relevant code has been refactored to build a dict of attributes,
allowing the default set to be overridden, and then printing them using
`flatatt`.

Fixes #1933
2015-11-24 11:38:10 +00:00
Rich Brennan 010838b53e Add Orderable to list of imported wagtailcore models 2015-11-24 10:36:02 +00:00
Rich Brennan fab4e2224f Move content_panels inside BookPage definition. 2015-11-24 10:36:02 +00:00
Karl Hobley 059fc15b9d Added note about Elasticsearch 2.x 2015-11-20 12:50:31 +00:00
Rich Brennan 2ad3985d67 Move content_panels inside BlogPage definition. 2015-11-19 17:16:02 +00:00
Matt Westcott c73a3caa31 Use rendition.alt in `{% image img as rendition %}` example.
This restores the documentation to the pre-#1517 state, and is evidently more natural to write since the original documentation did so by mistake :-)
2015-11-19 15:29:40 +00:00
Alex Gleason 6a0b576376 Updated reasoning for Page suffix, fixes #1927
Fixed typo
2015-11-16 20:06:36 +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
Matt Westcott c1edbe6a98 Merge branch 'docs-self-var' of https://github.com/kaedroho/wagtail into kaedroho-docs-self-var 2015-10-14 14:52:00 +01:00
Matt Westcott c2a183f19f Documentation tweaks as per https://github.com/torchbox/wagtail/pull/1815#commitcomment-13736415 https://github.com/torchbox/wagtail/pull/1815#commitcomment-13736421 2015-10-13 15:17:47 +01:00
Karl Hobley b278a0c0f8 Docs for custom ordering 2015-10-13 10:06:58 +01:00
Karl Hobley 6eae465e64 Renamed "self" template variable to "page" in docs 2015-10-13 09:52:16 +01:00
Matt Westcott 06e721bc74 document the 'operator' kwarg on QuerySet.search 2015-10-12 22:04:29 +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