kopia lustrzana https://github.com/wagtail/wagtail
Rename wagtail.wagtailembeds to wagtail.embeds
Conflicts: gulpfile.js/config.js wagtail/embeds/blocks.py wagtail/embeds/tests.py wagtail/embeds/views/chooser.py wagtail/embeds/wagtail_hooks.pypull/4068/head
rodzic
78b1372cd4
commit
54d8357f96
|
@ -26,8 +26,8 @@ source_lang = en
|
|||
type = PO
|
||||
|
||||
[wagtail.wagtailembeds]
|
||||
file_filter = wagtail/wagtailembeds/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/wagtailembeds/locale/en/LC_MESSAGES/django.po
|
||||
file_filter = wagtail/embeds/locale/<lang>/LC_MESSAGES/django.po
|
||||
source_file = wagtail/embeds/locale/en/LC_MESSAGES/django.po
|
||||
source_lang = en
|
||||
type = PO
|
||||
|
||||
|
|
|
@ -30,14 +30,14 @@ nest the embed code.
|
|||
``EmbedBlock`` StreamField block type
|
||||
-------------------------------------
|
||||
|
||||
The :class:`~wagtail.wagtailembeds.block.EmbedBlock` block type allows embeds
|
||||
The :class:`~wagtail.embeds.block.EmbedBlock` block type allows embeds
|
||||
to be placed into a ``StreamField``.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.blocks import EmbedBlock
|
||||
from wagtail.embeds.blocks import EmbedBlock
|
||||
|
||||
class MyStreamField(blocks.StreamBlock):
|
||||
...
|
||||
|
@ -74,8 +74,8 @@ fetching the embed code.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.embeds import get_embed
|
||||
from wagtail.wagtailembeds.exceptions import EmbedException
|
||||
from wagtail.embeds.embeds import get_embed
|
||||
from wagtail.embeds.exceptions import EmbedException
|
||||
|
||||
try:
|
||||
embed = get_embed('https://www.youtube.com/watch?v=SJXMTtvCxRo')
|
||||
|
@ -103,7 +103,7 @@ The default configuration is:
|
|||
|
||||
WAGTAILEMBEDS_FINDERS = [
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.oembed'
|
||||
'class': 'wagtail.embeds.finders.oembed'
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -132,7 +132,7 @@ and Youtube. It also adds a custom provider:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.oembed_providers import youtube, vimeo
|
||||
from wagtail.embeds.oembed_providers import youtube, vimeo
|
||||
|
||||
# Add a custom provider
|
||||
# Your custom provider must support oEmbed for this to work. You should be
|
||||
|
@ -148,7 +148,7 @@ and Youtube. It also adds a custom provider:
|
|||
|
||||
WAGTAILEMBEDS_FINDERS = [
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.oembed',
|
||||
'class': 'wagtail.embeds.finders.oembed',
|
||||
'providers': [youtube, vimeo, my_custom_provider],
|
||||
}
|
||||
]
|
||||
|
@ -164,21 +164,21 @@ For example, this is how you can instruct Youtube to return videos in HTTPS
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.oembed_providers import youtube
|
||||
from wagtail.embeds.oembed_providers import youtube
|
||||
|
||||
|
||||
WAGTAILEMBEDS_FINDERS = [
|
||||
# Fetches YouTube videos but puts ``?scheme=https`` in the GET parameters
|
||||
# when calling YouTube's oEmbed endpoint
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.oembed',
|
||||
'class': 'wagtail.embeds.finders.oembed',
|
||||
'providers': [youtube],
|
||||
'options': {'scheme': 'https'}
|
||||
},
|
||||
|
||||
# Handles all other oEmbed providers the default way
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.oembed',
|
||||
'class': 'wagtail.embeds.finders.oembed',
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -206,13 +206,13 @@ them.
|
|||
|
||||
Wagtail has built in support for fetching embeds from Embed.ly. To use it, add
|
||||
an embed finder to your ``WAGTAILEMBEDS_FINDERS`` setting that uses the
|
||||
``wagtail.wagtailembeds.finders.oembed`` class and pass it your API key:
|
||||
``wagtail.embeds.finders.oembed`` class and pass it your API key:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
WAGTAILEMBEDS_FINDERS = [
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.embedly',
|
||||
'class': 'wagtail.embeds.finders.embedly',
|
||||
'key': 'YOUR EMBED.LY KEY HERE'
|
||||
}
|
||||
]
|
||||
|
@ -229,7 +229,7 @@ docstrings for details of what each method does:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from wagtail.wagtailembeds.finders.base import EmbedFinder
|
||||
from wagtail.embeds.finders.base import EmbedFinder
|
||||
|
||||
|
||||
class ExampleFinder(EmbedFinder):
|
||||
|
@ -279,7 +279,7 @@ Once you've implemented all of those methods, you just need to add it to your
|
|||
The ``Embed`` model
|
||||
===================
|
||||
|
||||
.. class:: wagtail.wagtailembeds.models.Embed
|
||||
.. class:: wagtail.embeds.models.Embed
|
||||
|
||||
Embeds are fetched only once and stored in the database so subsequent requests
|
||||
for an individual embed do not hit the embed finders again.
|
||||
|
|
|
@ -62,7 +62,7 @@ Apps (``settings.py``)
|
|||
|
||||
'wagtail.wagtailforms',
|
||||
'wagtail.wagtailredirects',
|
||||
'wagtail.wagtailembeds',
|
||||
'wagtail.embeds',
|
||||
'wagtail.wagtailsites',
|
||||
'wagtail.wagtailusers',
|
||||
'wagtail.wagtailsnippets',
|
||||
|
@ -504,7 +504,7 @@ These two files should reside in your project directory (``myproject/myproject/`
|
|||
|
||||
'wagtail.wagtailforms',
|
||||
'wagtail.wagtailredirects',
|
||||
'wagtail.wagtailembeds',
|
||||
'wagtail.embeds',
|
||||
'wagtail.wagtailsites',
|
||||
'wagtail.wagtailusers',
|
||||
'wagtail.wagtailsnippets',
|
||||
|
|
|
@ -22,7 +22,7 @@ In your settings file, add the following apps to ``INSTALLED_APPS``:
|
|||
|
||||
'wagtail.wagtailforms',
|
||||
'wagtail.wagtailredirects',
|
||||
'wagtail.wagtailembeds',
|
||||
'wagtail.embeds',
|
||||
'wagtail.wagtailsites',
|
||||
'wagtail.wagtailusers',
|
||||
'wagtail.wagtailsnippets',
|
||||
|
|
|
@ -291,7 +291,7 @@ A control to allow the editor to select a snippet object. Requires one positiona
|
|||
EmbedBlock
|
||||
~~~~~~~~~~
|
||||
|
||||
``wagtail.wagtailembeds.blocks.EmbedBlock``
|
||||
``wagtail.embeds.blocks.EmbedBlock``
|
||||
|
||||
A field for the editor to enter a URL to a media item (such as a YouTube video) to appear as embedded media on the page. The keyword arguments ``required`` (default: True), ``max_length``, ``min_length`` and ``help_text`` are accepted.
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ App.prototype.scssSources = function() {
|
|||
var apps = [
|
||||
new App('wagtail/admin'),
|
||||
new App('wagtail/documents'),
|
||||
new App('wagtail/wagtailembeds'),
|
||||
new App('wagtail/embeds'),
|
||||
new App('wagtail/wagtailimages'),
|
||||
new App('wagtail/wagtailsnippets'),
|
||||
new App('wagtail/wagtailusers'),
|
||||
|
|
|
@ -106,9 +106,9 @@ class TestExpandDbHtml(TestCase):
|
|||
result = expand_db_html(html)
|
||||
self.assertEqual(result, '<a id="1">foo</a>')
|
||||
|
||||
@patch('wagtail.wagtailembeds.embeds.get_embed')
|
||||
@patch('wagtail.embeds.embeds.get_embed')
|
||||
def test_expand_db_html_with_embed(self, get_embed):
|
||||
from wagtail.wagtailembeds.models import Embed
|
||||
from wagtail.embeds.models import Embed
|
||||
get_embed.return_value = Embed(html='test html')
|
||||
html = '<embed embedtype="media" url="http://www.youtube.com/watch" />'
|
||||
result = expand_db_html(html)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
default_app_config = 'wagtail.embeds.apps.WagtailEmbedsAppConfig'
|
|
@ -6,7 +6,7 @@ from .finders import get_finders
|
|||
|
||||
|
||||
class WagtailEmbedsAppConfig(AppConfig):
|
||||
name = 'wagtail.wagtailembeds'
|
||||
name = 'wagtail.embeds'
|
||||
label = 'wagtailembeds'
|
||||
verbose_name = "Wagtail embeds"
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from wagtail.core import blocks
|
||||
from wagtail.wagtailembeds.format import embed_to_frontend_html
|
||||
from wagtail.embeds.format import embed_to_frontend_html
|
||||
|
||||
|
||||
class EmbedValue(object):
|
|
@ -31,7 +31,7 @@ def _get_config_from_settings():
|
|||
# Default to the oembed backend
|
||||
return [
|
||||
{
|
||||
'class': 'wagtail.wagtailembeds.finders.oembed',
|
||||
'class': 'wagtail.embeds.finders.oembed',
|
||||
}
|
||||
]
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from wagtail.wagtailembeds.exceptions import EmbedException, EmbedNotFoundException
|
||||
from wagtail.embeds.exceptions import EmbedException, EmbedNotFoundException
|
||||
|
||||
from .base import EmbedFinder
|
||||
|
|
@ -8,8 +8,8 @@ from urllib.error import URLError
|
|||
from urllib.parse import urlencode
|
||||
from urllib.request import Request
|
||||
|
||||
from wagtail.wagtailembeds.exceptions import EmbedNotFoundException
|
||||
from wagtail.wagtailembeds.oembed_providers import all_providers
|
||||
from wagtail.embeds.exceptions import EmbedNotFoundException
|
||||
from wagtail.embeds.oembed_providers import all_providers
|
||||
|
||||
from .base import EmbedFinder
|
||||
|
|
@ -2,8 +2,8 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
from wagtail.wagtailembeds import embeds
|
||||
from wagtail.wagtailembeds.exceptions import EmbedException
|
||||
from wagtail.embeds import embeds
|
||||
from wagtail.embeds.exceptions import EmbedException
|
||||
|
||||
|
||||
def embed_to_frontend_html(url):
|
|
@ -1,7 +1,7 @@
|
|||
from __future__ import absolute_import, unicode_literals
|
||||
|
||||
from wagtail.wagtailembeds import format
|
||||
from wagtail.wagtailembeds.exceptions import EmbedException
|
||||
from wagtail.embeds import format
|
||||
from wagtail.embeds.exceptions import EmbedException
|
||||
|
||||
|
||||
class MediaEmbedHandler(object):
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue