diff --git a/.coveragerc b/.coveragerc index 7f6f849cd..b49e59cd5 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,6 +5,7 @@ branch = True source = wagtail omit = + */south_migrations/* */migrations/* wagtail/vendor/* @@ -31,4 +32,4 @@ exclude_lines = ignore_errors = True [html] -directory = coverage_html_report \ No newline at end of file +directory = coverage_html_report diff --git a/.travis.yml b/.travis.yml index 2245157e7..f54d1392e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,38 @@ language: python -# Test matrix -python: - - 2.7 - - 3.2 - - 3.4 env: - - DJANGO_VERSION=Django==1.6.5 - #- DJANGO_VERSION=Django==1.7.0 +# - TOXENV=py26-dj16-postgres + - TOXENV=py26-dj16-sqlite + - TOXENV=py27-dj16-postgres +# - TOXENV=py27-dj16-sqlite + - TOXENV=py32-dj16-postgres +# - TOXENV=py33-dj16-postgres + - TOXENV=py34-dj16-postgres + - TOXENV=py27-dj17-postgres +# - TOXENV=py27-dj17-sqlite +# - TOXENV=py32-dj17-postgres +# - TOXENV=py33-dj17-postgres + - TOXENV=py34-dj17-postgres + # Services services: - redis-server - elasticsearch + # Package installation install: - - python setup.py install - - pip install psycopg2 elasticsearch wand embedly mock python-dateutil - - pip install coveralls + - pip install tox coveralls + # Pre-test configuration before_script: - psql -c 'create database wagtaildemo;' -U postgres + # Run the tests script: - coverage run runtests.py + tox + after_success: coveralls + # Who to notify about build results notifications: email: diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7530812f6..5122b8d1d 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -3,8 +3,12 @@ Changelog 0.6 (xx.xx.20xx) ~~~~~~~~~~~~~~~~ + * Added Django 1.7 support * Added {% routablepageurl %} template tag (@timheap) + * Added RoutablePageMixin (@timheap) + * Renamed wagtailsearch.indexed to wagtailsearch.index * Fix: Page URL generation now returns correct URLs for sites that have the main 'serve' view rooted somewhere other than '/' + * Fix: Search results in the page chooser now respect the page_type parameter on PageChooserPanel 0.5 (01.08.2014) ~~~~~~~~~~~~~~~~ diff --git a/README.rst b/README.rst index 5fa7f47f9..77d153f26 100644 --- a/README.rst +++ b/README.rst @@ -24,8 +24,8 @@ Wagtail is a Django content management system built originally for the `Royal Co * Support for tree-based content organisation * Optional preview->submit->approve workflow * Fast out of the box. `Varnish `_-friendly if you need it -* A simple `form builder `_ -* Optional `static site generation `_ +* A simple `form builder `_ +* Optional `static site generation `_ * Excellent `test coverage `_ Find out more at `wagtail.io `_. @@ -45,9 +45,7 @@ Available at `wagtail.readthedocs.org `_ and al Compatibility ~~~~~~~~~~~~~ -Wagtail supports Django 1.6.2+ on Python 2.6, 2.7, 3.2, 3.3 and 3.4. - -Django 1.7 support is in progress pending further release candidate testing. +Wagtail supports Django 1.6.2+ and 1.7rc3+ on Python 2.6, 2.7, 3.2, 3.3 and 3.4. Wagtail's dependencies are summarised at `requirements.io `_. @@ -55,8 +53,8 @@ Contributing ~~~~~~~~~~~~ If you're a Python or Django developer, fork the repo and get stuck in! -We suggest you start by checking the `Help develop me! `_ label and the `coding guidelines `_. +We suggest you start by checking the `Help develop me! `_ label and the `coding guidelines `_. Send us a useful pull request and we'll post you a `t-shirt `_. -We also welcome `translations `_ for Wagtail's interface. +We also welcome `translations `_ for Wagtail's interface. diff --git a/docs/core_components/images/using_images_outside_wagtail.rst b/docs/core_components/images/using_images_outside_wagtail.rst index 5671e8504..d3b63126b 100644 --- a/docs/core_components/images/using_images_outside_wagtail.rst +++ b/docs/core_components/images/using_images_outside_wagtail.rst @@ -71,7 +71,7 @@ Using the URLs on your website or blog Once you have generated a URL, you can put it straight into the ``src`` attribute of an ```` tag: -..code-block:: html + .. code-block:: html diff --git a/docs/core_components/index.rst b/docs/core_components/index.rst index cfa67d366..a28ddf1b7 100644 --- a/docs/core_components/index.rst +++ b/docs/core_components/index.rst @@ -4,6 +4,7 @@ Core components .. toctree:: :maxdepth: 2 + sites pages/index images/index snippets diff --git a/docs/core_components/pages/advanced_topics/routable_page.rst b/docs/core_components/pages/advanced_topics/routable_page_mixin.rst similarity index 64% rename from docs/core_components/pages/advanced_topics/routable_page.rst rename to docs/core_components/pages/advanced_topics/routable_page_mixin.rst index 465b0b148..36ca024c3 100644 --- a/docs/core_components/pages/advanced_topics/routable_page.rst +++ b/docs/core_components/pages/advanced_topics/routable_page_mixin.rst @@ -1,4 +1,4 @@ -.. _routable_page: +.. _routable_page_mixin: ==================================== Embedding URL configuration in Pages @@ -6,15 +6,15 @@ Embedding URL configuration in Pages .. versionadded:: 0.5 -The ``RoutablePage`` class provides a convenient way for a page to respond on multiple sub-URLs with different views. For example, a blog section on a site might provide several different types of index page at URLs like ``/blog/2013/06/``, ``/blog/authors/bob/``, ``/blog/tagged/python/``, all served by the same ``BlogIndex`` page. +The ``RoutablePageMixin`` mixin provides a convenient way for a page to respond on multiple sub-URLs with different views. For example, a blog section on a site might provide several different types of index page at URLs like ``/blog/2013/06/``, ``/blog/authors/bob/``, ``/blog/tagged/python/``, all served by the same ``BlogIndex`` page. -A ``RoutablePage`` exists within the page tree like any other page, but URL paths underneath it are checked against a list of patterns, using Django's urlconf scheme. If none of the patterns match, control is passed to subpages as usual (or failing that, a 404 error is thrown). +A ``Page`` using ``RoutablePageMixin`` exists within the page tree like any other page, but URL paths underneath it are checked against a list of patterns, using Django's urlconf scheme. If none of the patterns match, control is passed to subpages as usual (or failing that, a 404 error is thrown). The basics ========== -To use ``RoutablePage``, you need to make your class inherit from :class:`wagtail.contrib.wagtailroutablepage.models.RoutablePage` and configure the ``subpage_urls`` attribute with your URL configuration. +To use ``RoutablePageMixin``, you need to make your class inherit from both :class:`wagtail.contrib.wagtailroutablepage.models.RoutablePageMixin` and :class:`wagtail.wagtailcore.models.Page`, and configure the ``subpage_urls`` attribute with your URL configuration. Here's an example of an ``EventPage`` with three views: @@ -22,10 +22,11 @@ Here's an example of an ``EventPage`` with three views: from django.conf.urls import url - from wagtail.contrib.wagtailroutablepage.models import RoutablePage + from wagtail.contrib.wagtailroutablepage.models import RoutablePageMixin + from wagtail.wagtailcore.models import Page - class EventPage(RoutablePage): + class EventPage(RoutablePageMixin, Page): subpage_urls = ( url(r'^$', 'current_events', name='current_events'), url(r'^past/$', 'past_events', name='past_events'), @@ -40,7 +41,7 @@ Here's an example of an ``EventPage`` with three views: def past_events(self, request): """ - View function for the current events page + View function for the past events page """ ... @@ -51,11 +52,11 @@ Here's an example of an ``EventPage`` with three views: ... -The ``RoutablePage`` class -========================== +The ``RoutablePageMixin`` class +=============================== .. automodule:: wagtail.contrib.wagtailroutablepage.models -.. autoclass:: RoutablePage +.. autoclass:: RoutablePageMixin .. autoattribute:: subpage_urls @@ -65,7 +66,9 @@ The ``RoutablePage`` class from django.conf.urls import url - class MyPage(RoutablePage): + from wagtail.wagtailcore.models import Page + + class MyPage(RoutablePageMixin, Page): subpage_urls = ( url(r'^$', 'serve', name='main'), url(r'^archive/$', 'archive', name='archive'), diff --git a/docs/core_components/pages/creating_pages.rst b/docs/core_components/pages/creating_pages.rst index 7806274fa..e6fb9a14b 100644 --- a/docs/core_components/pages/creating_pages.rst +++ b/docs/core_components/pages/creating_pages.rst @@ -2,40 +2,15 @@ Creating page models ==================== +Wagtail provides a ``Page`` class to represent types of page (a.k.a Content types). Developers should subclass ``Page`` for their own page models. -The Page Class -~~~~~~~~~~~~~~ - -``Page`` uses Django's model interface, so you can include any field type and field options that Django allows. Wagtail provides some fields and editing handlers that simplify data entry in the Wagtail admin interface, so you may want to keep those in mind when deciding what properties to add to your models in addition to those already provided by ``Page``. +``Page`` uses Django's model interface, so you can include any field type and field options that Django allows. Wagtail provides some field types of its own which simplify data entry in the Wagtail admin interface. Wagtail also wraps Django's field types and widgets with its own concept of "Edit Handlers" and "Panels". These further improve the data entry experience. -Built-in Properties of the Page Class -------------------------------------- +An example Wagtail Page Model +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Wagtail provides some properties in the ``Page`` class which are common to most webpages. Since you'll be subclassing ``Page``, you don't have to worry about implementing them. - -Public Properties -````````````````` - - ``title`` (string, required) - Human-readable title for the content - - ``slug`` (string, required) - Machine-readable URL component for this piece of content. The name of the page as it will appear in URLs e.g ``http://domain.com/blog/[my-slug]/`` - - ``seo_title`` (string) - Alternate SEO-crafted title which overrides the normal title for use in the ```` of a page - - ``search_description`` (string) - A SEO-crafted description of the content, used in both internal search indexing and for the meta description read by search engines - -The ``Page`` class actually has alot more to it, but these are probably the only built-in properties you'll need to worry about when creating templates for your models. - - -Anatomy of a Wagtail Model -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -So what does a Wagtail model definition look like? Here's a model representing a typical blog post: +This example represents a typical blog post: .. code-block:: python @@ -58,6 +33,8 @@ So what does a Wagtail model definition look like? Here's a model representing a related_name='+' ) + + BlogPage.content_panels = [ FieldPanel('title', classname="full title"), FieldPanel('date'), @@ -72,17 +49,48 @@ So what does a Wagtail model definition look like? Here's a model representing a ImageChooserPanel('feed_image'), ] -To keep track of your ``Page``-derived models, it might be helpful to include "Page" as the last part of your class name. ``BlogPage`` defines three properties: ``body``, ``date``, and ``feed_image``. These are a mix of basic Django models (``DateField``), Wagtail fields (``RichTextField``), and a pointer to a Wagtail model (``Image``). +.. tip:: + To keep track of ``Page`` models and avoid class name clashes, it can be helpful to suffix model class names with "Page" e.g BlogPage, ListingIndexPage. -Next, the ``content_panels`` and ``promote_panels`` lists define the capabilities and layout of the Wagtail admin page edit interface. The lists are filled with "panels" and "choosers", which will provide a fine-grain interface for inputting the model's content. The ``ImageChooserPanel``, for instance, lets one browse the image library, upload new images, and input image metadata. The ``RichTextField`` is the basic field for creating web-ready website rich text, including text formatting and embedded media like images and video. The Wagtail admin offers other choices for fields, Panels, and Choosers, with the option of creating your own to precisely fit your content without workarounds or other compromises. +In the example above the ``BlogPage`` class defines three properties: ``body``, ``date``, and ``feed_image``. These are a mix of basic Django models (``DateField``), Wagtail fields (``RichTextField``), and a pointer to a Wagtail model (``Image``). + +Below that the ``content_panels`` and ``promote_panels`` lists define the capabilities and layout of the page editing interface in the Wagtail admin. The lists are filled with "panels" and "choosers", which will provide a fine-grain interface for inputting the model's content. The ``ImageChooserPanel``, for instance, lets one browse the image library, upload new images and input image metadata. The ``RichTextField`` is the basic field for creating web-ready website rich text, including text formatting and embedded media like images and video. The Wagtail admin offers other choices for fields, Panels, and Choosers, with the option of creating your own to precisely fit your content without workarounds or other compromises. Your models may be even more complex, with methods overriding the built-in functionality of the ``Page`` to achieve webdev magic. Or, you can keep your models simple and let Wagtail's built-in functionality do the work. -Now that we have a basic idea of how our content is defined, lets look at relationships between pieces of content. + +``Page`` Class Reference +~~~~~~~~~~~~~~~~~~~~~~~~ + +Default fields +-------------- + +Wagtail provides some fields for the ``Page`` class by default, which will be common to all your pages. You don't need to add these fields to your own page models however you do need to allocate them to ``content_panels``, ``promote_panels`` or ``settings_panels``. See above example and for further information on the panels see :ref:`editing-api`. + + ``title`` (string, required) + Human-readable title of the page - what you'd probably use as your ``

`` tag. + + ``slug`` (string, required) + Machine-readable URL component for this page. The name of the page as it will appear in URLs e.g ``http://domain.com/blog/[my-slug]/`` + + ``seo_title`` (string) + Alternate SEO-crafted title, mainly for use in the page ```` tag. + + ``search_description`` (string) + SEO-crafted description of the content, used for internal search indexing, suitable for your page's ``<meta name="description">`` tag. + + ``show_in_menus`` (boolean) + Toggles whether the page should be considered for inclusion in any site-wide menus you create. + + ``go_live_at`` (datetime) + A datetime on which the page should be automatically made published (made publicly accessible) + + ``expire_at`` (datetime) + A datetime on which the page should be unpublished, rendering it inaccessible to the public. -Page Properties and Methods Reference -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Page Attributes, Properties and Methods Reference +------------------------------------------------- In addition to the model fields provided, ``Page`` has many properties and methods that you may wish to reference, use, or override in creating your own models. Those listed here are relatively straightforward to use, but consult the Wagtail source code for a full view of what's possible. @@ -121,14 +129,21 @@ In addition to the model fields provided, ``Page`` has many properties and metho .. automethod:: search + .. attribute:: search_fields + + A list of fields to be indexed by the search engine. See Search docs :ref:`wagtailsearch_for_python_developers` -.. _wagtail_site_admin: + .. attribute:: subpage_types -Site -~~~~ + A whitelist of page models which can be created as children of this page type e.g a ``BlogIndex`` page might allow ``BlogPage``, but not ``JobPage`` e.g -Django's built-in admin interface provides the way to map a "site" (hostname or domain) to any node in the wagtail tree, using that node as the site's root. + .. code-block:: python + + class BlogIndex(Page): + subpage_types = ['mysite.BlogPage', 'mysite.BlogArchivePage'] + + .. attribute:: password_required_template + + Defines which template file should be used to render the login form for Protected pages using this model. This overrides the default, defined using ``PASSWORD_REQUIRED_TEMPLATE`` in your settings. See :ref:`private_pages` -Access this by going to ``/django-admin/`` and then "Home › Wagtailcore › Sites." To try out a development site, add a single site with the hostname ``localhost`` at port ``8000`` and map it to one of the pieces of content you have created. -Wagtail's developers plan to move the site settings into the Wagtail admin interface. diff --git a/docs/core_components/pages/editing_api.rst b/docs/core_components/pages/editing_api.rst index 4d346a815..f1025cbcb 100644 --- a/docs/core_components/pages/editing_api.rst +++ b/docs/core_components/pages/editing_api.rst @@ -1,3 +1,4 @@ +.. _editing-api: Defining models with the Editing API ==================================== diff --git a/docs/core_components/pages/index.rst b/docs/core_components/pages/index.rst index 1f350f35c..70d20d116 100644 --- a/docs/core_components/pages/index.rst +++ b/docs/core_components/pages/index.rst @@ -21,4 +21,4 @@ The presentation of your content, the actual webpages, includes the normal use o editing_api advanced_topics/queryset_methods advanced_topics/private_pages - advanced_topics/routable_page + advanced_topics/routable_page_mixin diff --git a/docs/core_components/pages/theory.rst b/docs/core_components/pages/theory.rst index 272ca3d1d..bcea079bb 100644 --- a/docs/core_components/pages/theory.rst +++ b/docs/core_components/pages/theory.rst @@ -1,3 +1,5 @@ +.. _pages-theory: + ====== Theory ====== diff --git a/docs/core_components/search/for_python_developers.rst b/docs/core_components/search/for_python_developers.rst index b99795e7b..b254a2e1f 100644 --- a/docs/core_components/search/for_python_developers.rst +++ b/docs/core_components/search/for_python_developers.rst @@ -10,6 +10,8 @@ For Python developers Basic usage =========== +By default using the :ref:`wagtailsearch_backends_database`, Wagtail's search will only index the ``title`` field of pages. + All searches are performed on Django QuerySets. Wagtail provides a ``search`` method on the queryset for all page models: .. code-block:: python @@ -35,20 +37,20 @@ Indexing extra fields The ``indexed_fields`` configuration format was replaced with ``search_fields`` +.. versionchanged:: 0.6 -.. note:: - - Searching on extra fields with the database backend is not currently supported. + The ``wagtail.wagtailsearch.indexed`` module was renamed to ``wagtail.wagtailsearch.index`` -Fields need to be explicitly added to the search configuration in order for you to be able to search/filter on them. +.. warning:: -You can add new fields to the search index by overriding the ``search_fields`` property and appending a list of extra ``SearchField``/``FilterField`` objects to it. - -The default value of ``search_fields`` (as set in ``Page``) indexes the ``title`` field as a ``SearchField`` and some other generally useful fields as ``FilterField`` rules. + Indexing extra fields is only supported with ElasticSearch as your backend. If you're using the database backend, any other fields you define via ``search_fields`` will be ignored. -Quick example +Fields must be explicitly added to the ``search_fields`` property of your ``Page``-derived model, in order for you to be able to search/filter on them. This is done by overriding ``search_fields`` to append a list of extra ``SearchField``/``FilterField`` objects to it. + + +Example ------------- This creates an ``EventPage`` model with two fields ``description`` and ``date``. ``description`` is indexed as a ``SearchField`` and ``date`` is indexed as a ``FilterField`` @@ -56,15 +58,15 @@ This creates an ``EventPage`` model with two fields ``description`` and ``date`` .. code-block:: python - from wagtail.wagtailsearch import indexed + from wagtail.wagtailsearch import index class EventPage(Page): description = models.TextField() date = models.DateField() search_fields = Page.search_fields + ( # Inherit search_fields from Page - indexed.SearchField('description'), - indexed.FilterField('date'), + index.SearchField('description'), + index.FilterField('date'), ) @@ -72,7 +74,7 @@ This creates an ``EventPage`` model with two fields ``description`` and ``date`` >>> EventPage.objects.filter(date__gt=timezone.now()).search("Christmas") -``indexed.SearchField`` +``index.SearchField`` ----------------------- These are added to the search index and are used for performing full-text searches on your models. These would usually be text fields. @@ -86,7 +88,7 @@ Options - **es_extra** (dict) - This field is to allow the developer to set or override any setting on the field in the ElasticSearch mapping. Use this if you want to make use of any ElasticSearch features that are not yet supported in Wagtail. -``indexed.FilterField`` +``index.FilterField`` ----------------------- These are added to the search index but are not used for full-text searches. Instead, they allow you to run filters on your search results. @@ -107,7 +109,7 @@ One use for this is indexing ``get_*_display`` methods Django creates automatica .. code-block:: python - from wagtail.wagtailsearch import indexed + from wagtail.wagtailsearch import index class EventPage(Page): IS_PRIVATE_CHOICES = ( @@ -119,10 +121,10 @@ One use for this is indexing ``get_*_display`` methods Django creates automatica search_fields = Page.search_fields + ( # Index the human-readable string for searching - indexed.SearchField('get_is_private_display'), + index.SearchField('get_is_private_display'), # Index the boolean value for filtering - indexed.FilterField('is_private'), + index.FilterField('is_private'), ) @@ -131,25 +133,25 @@ Indexing non-page models Any Django model can be indexed and searched. -To do this, inherit from ``indexed.Indexed`` and add some ``search_fields`` to the model. +To do this, inherit from ``index.Indexed`` and add some ``search_fields`` to the model. .. code-block:: python - from wagtail.wagtailsearch import indexed + from wagtail.wagtailsearch import index - class Book(models.Model, indexed.Indexed): + class Book(models.Model, index.Indexed): title = models.CharField(max_length=255) genre = models.CharField(max_length=255, choices=GENRE_CHOICES) author = models.ForeignKey(Author) published_date = models.DateTimeField() search_fields = ( - indexed.SearchField('title', partial_match=True, boost=10), - indexed.SearchField('get_genre_display'), + index.SearchField('title', partial_match=True, boost=10), + index.SearchField('get_genre_display'), - indexed.FilterField('genre'), - indexed.FilterField('author'), - indexed.FilterField('published_date'), + index.FilterField('genre'), + index.FilterField('author'), + index.FilterField('published_date'), ) # As this model doesn't have a search method in its QuerySet, we have to call search directly on the backend diff --git a/docs/core_components/sites.rst b/docs/core_components/sites.rst new file mode 100644 index 000000000..89c490b65 --- /dev/null +++ b/docs/core_components/sites.rst @@ -0,0 +1,10 @@ +.. _wagtail_site_admin: + +Sites +===== + +Django's built-in admin interface provides the way to map a "site" (hostname or domain) to any node in the wagtail tree, using that node as the site's root. See :ref:`pages-theory`. + +Access this by going to ``/django-admin/`` and then "Home › Wagtailcore › Sites." To try out a development site, add a single site with the hostname ``localhost`` at port ``8000`` and map it to one of the pieces of content you have created. + +Wagtail's developers plan to move the site settings into the Wagtail admin interface. diff --git a/docs/howto/index.rst b/docs/howto/index.rst index 01ce20d13..c9826e4d5 100644 --- a/docs/howto/index.rst +++ b/docs/howto/index.rst @@ -8,4 +8,5 @@ How to settings deploying performance + multilingual_sites contributing diff --git a/docs/howto/multilingual_sites.rst b/docs/howto/multilingual_sites.rst new file mode 100644 index 000000000..1d73a18fb --- /dev/null +++ b/docs/howto/multilingual_sites.rst @@ -0,0 +1,146 @@ +=========================== +Creating multilingual sites +=========================== + +This tutorial will show you a method of creating multilingual sites in Wagtail. + +Currently, Wagtail doesn't support multiple languages in the same page. The recommended way of creating multilingual websites in Wagtail at the moment is to create one section of your website for each language. + +For example:: + + / + en/ + about/ + contact/ + fr/ + about/ + contact/ + + +The root page +============= + +The root page (``/``) should detect the browsers language and forward them to the correct language homepage (``/en/``, ``/fr/``). This page should sit at the site root (where the homepage would normally be). + +We must set Djangos ``LANGUAGES`` setting so we don't redirect non English/French users to pages that don't exist. + + +.. code-block:: python + + # settings.py + LANGUAGES = ( + ('en', _("English")), + ('fr', _("French")), + ) + + # models.py + from django.utils import translation + from django.http import HttpResponseRedirect + + from wagtail.wagtailcore.models import Page + + + class LanguageRedirectionPage(Page): + + def serve(self, request): + # This will only return a language that is in the LANGUAGES Django setting + language = translation.get_language_from_request(request) + + return HttpResponseRedirect(self.url + language + '/') + + +Linking pages together +====================== + +It may be useful to link different versions of the same page together to allow the user to easily switch between languages. But we don't want to increse the burdon on the editor too much so ideally, editors should only need to link one of the pages to the other versions and the links between the other versions should be created implicitly. + +As this behaviour needs to be added to all page types that would be translated, its best to put this behaviour in a mixin. + +Heres an example of how this could be implemented (with English as the main language and French/Spanish as alternative languages): + +.. code-block:: python + + class TranslatablePageMixin(models.Model): + # One link for each alternative language + # These should only be used on the main language page (english) + french_link = models.ForeignKey(Page, null=True, on_delete=models.SET_NULL, blank=True, related_name='+') + spanish_link = models.ForeignKey(Page, null=True, on_delete=models.SET_NULL, blank=True, related_name='+') + + def get_language(self): + """ + This returns the language code for this page. + """ + # Look through ancestors of this page for its language homepage + # The language homepage is located at depth 3 + language_homepage = self.get_ancestors(inclusive=True).get(depth=3) + + # The slug of language homepages should always be set to the language code + return language_homepage.slug + + + # Method to find the main language version of this page + # This works by reversing the above links + + def english_page(self): + """ + This finds the english version of this page + """ + language = self.get_language() + + if language == 'en': + return self + elif language == 'fr': + return type(self).objects.filter(french_link=self).first().specific + elif language == 'es': + return type(self).objects.filter(spanish_link=self).first().specific + + + # We need a method to find a version of this page for each alternative language. + # These all work the same way. They firstly find the main version of the page + # (english), then from there they can just follow the link to the correct page. + + def french_page(self): + """ + This finds the french version of this page + """ + english_page = self.english_page() + + if english_page and english_page.french_link: + return english_page.french_link.specific + + def spanish_page(self): + """ + This finds the spanish version of this page + """ + english_page = self.english_page() + + if english_page and english_page.spanish_link: + return english_page.spanish_link.specific + + class Meta: + abstract = True + + + class AboutPage(Page, TranslatablePageMixin): + ... + + + class ContactPage(Page, TranslatablePageMixin): + ... + + +You can make use of these methods in your template by doing: + +.. code-block:: django + + {% if self.english_page and self.get_language != 'en' %} + <a href="{{ self.english_page.url }}">{% trans "View in English" %}</a> + {% endif %} + + {% if self.french_page and self.get_language != 'fr' %} + <a href="{{ self.french_page.url }}">{% trans "View in French" %}</a> + {% endif %} + + {% if self.spanish_page and self.get_language != 'es' %} + <a href="{{ self.spanish_page.url }}">{% trans "View in Spanish" %}</a> + {% endif %} diff --git a/docs/index.rst b/docs/index.rst index 0ce7b02fa..55575fbff 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,7 +3,7 @@ Welcome to Wagtail's documentation Wagtail is a modern, flexible CMS, built on Django. -It supports Django 1.6.2+ on Python 2.6, 2.7, 3.2, 3.3 and 3.4. Django 1.7 support is in progress pending further release candidate testing. +It supports Django 1.6.2+ and 1.7rc3+ on Python 2.6, 2.7, 3.2, 3.3 and 3.4. .. toctree:: :maxdepth: 3 diff --git a/docs/releases/0.5.rst b/docs/releases/0.5.rst index 1e440e27f..6f4912de5 100644 --- a/docs/releases/0.5.rst +++ b/docs/releases/0.5.rst @@ -37,7 +37,7 @@ RoutablePage A ``RoutablePage`` model has been added to allow embedding Django-style URL routing within a page. -:ref:`routable_page` +:ref:`routable_page_mixin` Usage stats for images, documents and snippets @@ -129,4 +129,4 @@ South upgraded to 1.0 In preparation for Django 1.7 support in a future release, Wagtail now depends on South 1.0, and its migration files have been moved from ``migrations`` to ``south_migrations``. Older versions of South will fail to find the migrations in the new location. -If your project's requirements file (most commonly requirements.txt or requirements/base.txt) references a specific older version of South, this must be updated to South 1.0. \ No newline at end of file +If your project's requirements file (most commonly requirements.txt or requirements/base.txt) references a specific older version of South, this must be updated to South 1.0. diff --git a/docs/releases/0.6.rst b/docs/releases/0.6.rst index 5ab1769da..a5fbad591 100644 --- a/docs/releases/0.6.rst +++ b/docs/releases/0.6.rst @@ -10,14 +10,29 @@ Wagtail 0.6 release notes - IN DEVELOPMENT What's new ========== +Django 1.7 support +~~~~~~~~~~~~~~~~~~ + +Wagtail can now be used with Django 1.7. + + Minor features ~~~~~~~~~~~~~~ * A new template tag has been added for reversing URLs inside routable pages. See :ref:`routablepageurl_template_tag`. + * RoutablePage can now be used as a mixin. See :class:`wagtail.contrib.wagtailroutablepage.models.RoutablePageMixin`. Bug fixes ~~~~~~~~~ * Page URL generation now returns correct URLs for sites that have the main 'serve' view rooted somewhere other than '/'. + * Search results in the page chooser now respect the page_type parameter on PageChooserPanel. Upgrade considerations ====================== + + +Deprecated features +=================== + + * The ``wagtail.wagtailsearch.indexed`` module has been renamed to ``wagtail.wagtailsearch.index`` + \ No newline at end of file diff --git a/runtests.py b/runtests.py index 3a7399233..7961d2e19 100755 --- a/runtests.py +++ b/runtests.py @@ -2,6 +2,7 @@ import sys import os import shutil +import warnings from django.core.management import execute_from_command_line @@ -12,6 +13,9 @@ os.environ['DJANGO_SETTINGS_MODULE'] = 'wagtail.tests.settings' def runtests(): + # Don't ignore DeprecationWarnings + warnings.simplefilter('default', DeprecationWarning) + argv = sys.argv[:1] + ['test'] + sys.argv[1:] try: execute_from_command_line(argv) diff --git a/setup.py b/setup.py index 4d22021ed..c722911ad 100644 --- a/setup.py +++ b/setup.py @@ -23,12 +23,12 @@ PY3 = sys.version_info[0] == 3 install_requires = [ - "Django>=1.6.2,<1.7", + "Django>=1.6.2,<1.8", "South==1.0.0", "django-compressor>=1.4", "django-libsass>=0.2", "django-modelcluster>=0.3", - "django-taggit==0.12.0", + "django-taggit==0.12.1", "django-treebeard==2.0", "Pillow>=2.3.0", "beautifulsoup4>=4.3.2", diff --git a/tox.ini b/tox.ini index 5e68ac99a..a3a691f2d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,40 @@ [deps] -dj16= - Django>=1.6,<1.7 +base = + South==1.0.0 + django-compressor>=1.4 + django-libsass>=0.2 + django-modelcluster>=0.3 + django-taggit==0.12.1 + django-treebeard==2.0 + Pillow>=2.3.0 + beautifulsoup4>=4.3.2 + html5lib==0.999 + Unidecode>=0.04.14 + six==1.7.3 + requests==2.3.0 elasticsearch==1.1.0 mock==1.0.1 python-dateutil==2.2 + Embedly + coverage + +dj16 = + Django>=1.6,<1.7 + + +dj17 = + https://github.com/django/django/archive/stable/1.7.x.zip#egg=django + +py2 = + unicodecsv>=0.9.4 + +py3 = + [tox] +skipsdist = True +usedevelop = True + envlist = py26-dj16-postgres, py26-dj16-sqlite, @@ -13,7 +42,16 @@ envlist = py27-dj16-sqlite, py32-dj16-postgres, py33-dj16-postgres, - py34-dj16-postgres + py34-dj16-postgres, + + py27-dj17-postgres, + py27-dj17-sqlite, + py32-dj17-postgres, + py32-dj17-sqlite, + py33-dj17-postgres, + py33-dj17-sqlite, + py34-dj17-postgres, + py34-dj17-sqlite # mysql not currently supported # (wagtail.wagtailimages.tests.TestImageEditView currently fails with a @@ -28,11 +66,13 @@ envlist = [testenv] -commands=./runtests.py +commands=coverage run runtests.py [testenv:py26-dj16-postgres] basepython=python2.6 deps = + {[deps]base} + {[deps]py2} {[deps]dj16} psycopg2==2.5.3 setenv = @@ -41,6 +81,8 @@ setenv = [testenv:py26-dj16-sqlite] basepython=python2.6 deps = + {[deps]base} + {[deps]py2} {[deps]dj16} setenv = DATABASE_ENGINE=django.db.backends.sqlite3 @@ -48,6 +90,8 @@ setenv = [testenv:py26-dj16-mysql] basepython=python2.6 deps = + {[deps]base} + {[deps]py2} {[deps]dj16} MySQL-python==1.2.5 setenv = @@ -57,6 +101,8 @@ setenv = [testenv:py27-dj16-postgres] basepython=python2.7 deps = + {[deps]base} + {[deps]py2} {[deps]dj16} psycopg2==2.5.3 setenv = @@ -65,6 +111,8 @@ setenv = [testenv:py27-dj16-sqlite] basepython=python2.7 deps = + {[deps]base} + {[deps]py2} {[deps]dj16} setenv = DATABASE_ENGINE=django.db.backends.sqlite3 @@ -72,6 +120,8 @@ setenv = [testenv:py27-dj16-mysql] basepython=python2.7 deps = + {[deps]base} + {[deps]py2} {[deps]dj16} MySQL-python==1.2.5 setenv = @@ -81,6 +131,8 @@ setenv = [testenv:py32-dj16-postgres] basepython=python3.2 deps = + {[deps]base} + {[deps]py3} {[deps]dj16} psycopg2==2.5.3 setenv = @@ -89,6 +141,8 @@ setenv = [testenv:py32-dj16-sqlite] basepython=python3.2 deps = + {[deps]base} + {[deps]py3} {[deps]dj16} setenv = DATABASE_ENGINE=django.db.backends.sqlite3 @@ -96,6 +150,8 @@ setenv = [testenv:py33-dj16-postgres] basepython=python3.3 deps = + {[deps]base} + {[deps]py3} {[deps]dj16} psycopg2==2.5.3 setenv = @@ -104,6 +160,8 @@ setenv = [testenv:py33-dj16-sqlite] basepython=python3.3 deps = + {[deps]base} + {[deps]py3} {[deps]dj16} setenv = DATABASE_ENGINE=django.db.backends.sqlite3 @@ -111,6 +169,8 @@ setenv = [testenv:py34-dj16-postgres] basepython=python3.4 deps = + {[deps]base} + {[deps]py3} {[deps]dj16} psycopg2==2.5.3 setenv = @@ -119,6 +179,95 @@ setenv = [testenv:py34-dj16-sqlite] basepython=python3.4 deps = + {[deps]base} + {[deps]py3} {[deps]dj16} setenv = DATABASE_ENGINE=django.db.backends.sqlite3 + +[testenv:py27-dj17-postgres] +basepython=python2.7 +deps = + {[deps]base} + {[deps]py2} + {[deps]dj17} + psycopg2==2.5.3 +setenv = + DATABASE_ENGINE=django.db.backends.postgresql_psycopg2 + +[testenv:py27-dj17-sqlite] +basepython=python2.7 +deps = + {[deps]base} + {[deps]py2} + {[deps]dj17} +setenv = + DATABASE_ENGINE=django.db.backends.sqlite3 + +[testenv:py27-dj17-mysql] +basepython=python2.7 +deps = + {[deps]base} + {[deps]py2} + {[deps]dj17} + MySQL-python==1.2.5 +setenv = + DATABASE_ENGINE=django.db.backends.mysql + DATABASE_USER=wagtail + +[testenv:py32-dj17-postgres] +basepython=python3.2 +deps = + {[deps]base} + {[deps]py3} + {[deps]dj17} + psycopg2==2.5.3 +setenv = + DATABASE_ENGINE=django.db.backends.postgresql_psycopg2 + +[testenv:py32-dj17-sqlite] +basepython=python3.2 +deps = + {[deps]base} + {[deps]py3} + {[deps]dj17} +setenv = + DATABASE_ENGINE=django.db.backends.sqlite3 + +[testenv:py33-dj17-postgres] +basepython=python3.3 +deps = + {[deps]base} + {[deps]py3} + {[deps]dj17} + psycopg2==2.5.3 +setenv = + DATABASE_ENGINE=django.db.backends.postgresql_psycopg2 + +[testenv:py33-dj17-sqlite] +basepython=python3.3 +deps = + {[deps]base} + {[deps]py3} + {[deps]dj17} +setenv = + DATABASE_ENGINE=django.db.backends.sqlite3 + +[testenv:py34-dj17-postgres] +basepython=python3.4 +deps = + {[deps]base} + {[deps]py3} + {[deps]dj17} + psycopg2==2.5.3 +setenv = + DATABASE_ENGINE=django.db.backends.postgresql_psycopg2 + +[testenv:py34-dj17-sqlite] +basepython=python3.4 +deps = + {[deps]base} + {[deps]py3} + {[deps]dj17} +setenv = + DATABASE_ENGINE=django.db.backends.sqlite3 diff --git a/wagtail/contrib/wagtailfrontendcache/__init__.py b/wagtail/contrib/wagtailfrontendcache/__init__.py index e69de29bb..2cd2d60cb 100644 --- a/wagtail/contrib/wagtailfrontendcache/__init__.py +++ b/wagtail/contrib/wagtailfrontendcache/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.contrib.wagtailfrontendcache.apps.WagtailFrontendCacheAppConfig' diff --git a/wagtail/contrib/wagtailfrontendcache/apps.py b/wagtail/contrib/wagtailfrontendcache/apps.py new file mode 100644 index 000000000..2fa34a0da --- /dev/null +++ b/wagtail/contrib/wagtailfrontendcache/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailFrontendCacheAppConfig(AppConfig): + name = 'wagtail.contrib.wagtailfrontendcache' + label = 'wagtailfrontendcache' + verbose_name = "Wagtail frontend cache" diff --git a/wagtail/contrib/wagtailmedusa/__init__.py b/wagtail/contrib/wagtailmedusa/__init__.py index e69de29bb..5d5f8ce96 100644 --- a/wagtail/contrib/wagtailmedusa/__init__.py +++ b/wagtail/contrib/wagtailmedusa/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.contrib.wagtailmedusa.apps.WagtailMedusaAppConfig' diff --git a/wagtail/contrib/wagtailmedusa/apps.py b/wagtail/contrib/wagtailmedusa/apps.py new file mode 100644 index 000000000..46143d137 --- /dev/null +++ b/wagtail/contrib/wagtailmedusa/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailMedusaAppConfig(AppConfig): + name = 'wagtail.contrib.wagtailmedusa' + label = 'wagtailmedusa' + verbose_name = "Wagtail medusa" diff --git a/wagtail/contrib/wagtailroutablepage/__init__.py b/wagtail/contrib/wagtailroutablepage/__init__.py index e69de29bb..286151ff0 100644 --- a/wagtail/contrib/wagtailroutablepage/__init__.py +++ b/wagtail/contrib/wagtailroutablepage/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.contrib.wagtailroutablepage.apps.WagtailRoutablePageAppConfig' diff --git a/wagtail/contrib/wagtailroutablepage/apps.py b/wagtail/contrib/wagtailroutablepage/apps.py new file mode 100644 index 000000000..c3b9c9573 --- /dev/null +++ b/wagtail/contrib/wagtailroutablepage/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailRoutablePageAppConfig(AppConfig): + name = 'wagtail.contrib.wagtailroutablepage' + label = 'wagtailroutablepage' + verbose_name = "Wagtail routablepage" diff --git a/wagtail/contrib/wagtailroutablepage/models.py b/wagtail/contrib/wagtailroutablepage/models.py index 926e5f48a..88379b37a 100644 --- a/wagtail/contrib/wagtailroutablepage/models.py +++ b/wagtail/contrib/wagtailroutablepage/models.py @@ -8,9 +8,10 @@ from wagtail.wagtailcore.models import Page from wagtail.wagtailcore.url_routing import RouteResult -class RoutablePage(Page): +class RoutablePageMixin(object): """ - This class extends Page by adding methods to allow urlconfs to be embedded inside pages + This class can be mixed in to a Page subclass to allow urlconfs to be + embedded inside pages. """ #: Set this to a tuple of ``django.conf.urls.url`` objects. subpage_urls = None @@ -59,7 +60,7 @@ class RoutablePage(Page): except Http404: pass - return super(RoutablePage, self).route(request, path_components) + return super(RoutablePageMixin, self).route(request, path_components) def serve(self, request, view, args, kwargs): return view(request, *args, **kwargs) @@ -68,6 +69,13 @@ class RoutablePage(Page): view, args, kwargs = self.resolve_subpage('/') return view(*args, **kwargs) + +class RoutablePage(RoutablePageMixin, Page): + """ + This class extends Page by adding methods to allow urlconfs + to be embedded inside pages + """ + is_abstract = True class Meta: diff --git a/wagtail/contrib/wagtailsitemaps/__init__.py b/wagtail/contrib/wagtailsitemaps/__init__.py index e69de29bb..e647b7be1 100644 --- a/wagtail/contrib/wagtailsitemaps/__init__.py +++ b/wagtail/contrib/wagtailsitemaps/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.contrib.wagtailsitemaps.apps.WagtailSitemapsAppConfig' diff --git a/wagtail/contrib/wagtailsitemaps/apps.py b/wagtail/contrib/wagtailsitemaps/apps.py new file mode 100644 index 000000000..d8b249a2a --- /dev/null +++ b/wagtail/contrib/wagtailsitemaps/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailSitemapsAppConfig(AppConfig): + name = 'wagtail.contrib.wagtailsitemaps' + label = 'wagtailsitemaps' + verbose_name = "Wagtail sitemaps" diff --git a/wagtail/contrib/wagtailstyleguide/__init__.py b/wagtail/contrib/wagtailstyleguide/__init__.py index e69de29bb..18ff63cfe 100644 --- a/wagtail/contrib/wagtailstyleguide/__init__.py +++ b/wagtail/contrib/wagtailstyleguide/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.contrib.wagtailstyleguide.apps.WagtailStyleGuideAppConfig' diff --git a/wagtail/contrib/wagtailstyleguide/apps.py b/wagtail/contrib/wagtailstyleguide/apps.py new file mode 100644 index 000000000..093003ac8 --- /dev/null +++ b/wagtail/contrib/wagtailstyleguide/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailStyleGuideAppConfig(AppConfig): + name = 'wagtail.contrib.wagtailstyleguide' + label = 'wagtailstyleguide' + verbose_name = "Wagtail style guide" diff --git a/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html b/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html index bca7ce8a1..667798c80 100644 --- a/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html +++ b/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html @@ -30,6 +30,7 @@ <li><a href="#editor">Page editor</a></li> <li><a href="#tabs">Tabs</a></li> <li><a href="#breadcrumbs">Breadcrumbs</a></li> + <li><a href="#progress">Progress indicators</a></li> <li><a href="#misc">Misc formatters</a></li> <li><a href="#icons">Icons</a></li> </ul> @@ -406,6 +407,20 @@ </section> + <section id="progress"> + <h2>Progress indicators</h2> + + <div id="progress-example" class="progress active"> + <div class="bar">60%</div> + </div> + + <p> </p> + + <div id="progress-example2" class="progress active"> + <div class="bar" style="width: 50%;">50%</div> + </div> + </section> + <section id="misc"> <h2>Misc formatters</h2> <h3>Avatar icons</h3> @@ -506,7 +521,16 @@ {% block extra_js %} <script> $(function(){ - + (function runprogress(){ + var to = setTimeout(function(){ + runprogress(); + clearTimeout(to); + var to2 = setTimeout(function(){ + $('#progress-example .bar').css('width', '20%'); + }, 2000); + }, 3000); + $('#progress-example .bar').css('width', '80%'); + })(); }) </script> {% endblock %} \ No newline at end of file diff --git a/wagtail/tests/migrations/0001_initial.py b/wagtail/tests/migrations/0001_initial.py new file mode 100644 index 000000000..c1dd942f5 --- /dev/null +++ b/wagtail/tests/migrations/0001_initial.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('auth', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='CustomUser', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last login')), + ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), + ('username', models.CharField(unique=True, max_length=100)), + ('email', models.EmailField(max_length=255, blank=True)), + ('is_staff', models.BooleanField(default=True)), + ('is_active', models.BooleanField(default=True)), + ('first_name', models.CharField(max_length=50, blank=True)), + ('last_name', models.CharField(max_length=50, blank=True)), + ('groups', models.ManyToManyField(to='auth.Group', verbose_name='groups', blank=True)), + ('user_permissions', models.ManyToManyField(to='auth.Permission', verbose_name='user permissions', blank=True)), + ], + options={ + 'abstract': False, + }, + bases=(models.Model,), + ), + ] diff --git a/wagtail/tests/migrations/0002_auto_20140827_0908.py b/wagtail/tests/migrations/0002_auto_20140827_0908.py new file mode 100644 index 000000000..66c85ffb0 --- /dev/null +++ b/wagtail/tests/migrations/0002_auto_20140827_0908.py @@ -0,0 +1,386 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.db.models.deletion +import modelcluster.fields +import wagtail.contrib.wagtailroutablepage.models +import wagtail.wagtailcore.fields +import wagtail.wagtailsearch.index +import modelcluster.tags + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0002_initial_data'), + ('wagtaildocs', '0002_initial_data'), + ('taggit', '0001_initial'), + ('wagtailimages', '0002_initial_data'), + ('tests', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Advert', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('url', models.URLField(null=True, blank=True)), + ('text', models.CharField(max_length=255)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='AdvertPlacement', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('advert', models.ForeignKey(to='tests.Advert', related_name='+')), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='AlphaSnippet', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('text', models.CharField(max_length=255)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='BusinessChild', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='BusinessIndex', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='BusinessSubIndex', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='EventIndex', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ('intro', wagtail.wagtailcore.fields.RichTextField(blank=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='EventPage', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ('date_from', models.DateField(null=True, verbose_name='Start date')), + ('date_to', models.DateField(null=True, help_text='Not required if event is on a single day', blank=True, verbose_name='End date')), + ('time_from', models.TimeField(null=True, blank=True, verbose_name='Start time')), + ('time_to', models.TimeField(null=True, blank=True, verbose_name='End time')), + ('audience', models.CharField(choices=[('public', 'Public'), ('private', 'Private')], max_length=255)), + ('location', models.CharField(max_length=255)), + ('body', wagtail.wagtailcore.fields.RichTextField(blank=True)), + ('cost', models.CharField(max_length=255)), + ('signup_link', models.URLField(blank=True)), + ('feed_image', models.ForeignKey(related_name='+', blank=True, to='wagtailimages.Image', on_delete=django.db.models.deletion.SET_NULL, null=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='EventPageCarouselItem', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('sort_order', models.IntegerField(null=True, blank=True, editable=False)), + ('link_external', models.URLField(blank=True, verbose_name='External link')), + ('embed_url', models.URLField(blank=True, verbose_name='Embed URL')), + ('caption', models.CharField(blank=True, max_length=255)), + ('image', models.ForeignKey(related_name='+', blank=True, to='wagtailimages.Image', on_delete=django.db.models.deletion.SET_NULL, null=True)), + ('link_document', models.ForeignKey(related_name='+', blank=True, to='wagtaildocs.Document', null=True)), + ], + options={ + 'abstract': False, + 'ordering': ['sort_order'], + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='EventPageRelatedLink', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('sort_order', models.IntegerField(null=True, blank=True, editable=False)), + ('link_external', models.URLField(blank=True, verbose_name='External link')), + ('title', models.CharField(help_text='Link title', max_length=255)), + ('link_document', models.ForeignKey(related_name='+', blank=True, to='wagtaildocs.Document', null=True)), + ], + options={ + 'abstract': False, + 'ordering': ['sort_order'], + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='EventPageSpeaker', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('sort_order', models.IntegerField(null=True, blank=True, editable=False)), + ('link_external', models.URLField(blank=True, verbose_name='External link')), + ('first_name', models.CharField(blank=True, verbose_name='Name', max_length=255)), + ('last_name', models.CharField(blank=True, verbose_name='Surname', max_length=255)), + ('image', models.ForeignKey(related_name='+', blank=True, to='wagtailimages.Image', on_delete=django.db.models.deletion.SET_NULL, null=True)), + ('link_document', models.ForeignKey(related_name='+', blank=True, to='wagtaildocs.Document', null=True)), + ], + options={ + 'abstract': False, + 'ordering': ['sort_order'], + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='FormField', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('sort_order', models.IntegerField(null=True, blank=True, editable=False)), + ('label', models.CharField(help_text='The label of the form field', max_length=255)), + ('field_type', models.CharField(choices=[('singleline', 'Single line text'), ('multiline', 'Multi-line text'), ('email', 'Email'), ('number', 'Number'), ('url', 'URL'), ('checkbox', 'Checkbox'), ('checkboxes', 'Checkboxes'), ('dropdown', 'Drop down'), ('radio', 'Radio buttons'), ('date', 'Date'), ('datetime', 'Date/time')], max_length=16)), + ('required', models.BooleanField(default=True)), + ('choices', models.CharField(blank=True, help_text='Comma seperated list of choices. Only applicable in checkboxes, radio and dropdown.', max_length=512)), + ('default_value', models.CharField(blank=True, help_text='Default value. Comma seperated values supported for checkboxes.', max_length=255)), + ('help_text', models.CharField(blank=True, max_length=255)), + ], + options={ + 'abstract': False, + 'ordering': ['sort_order'], + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='FormPage', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ('to_address', models.CharField(blank=True, help_text='Optional - form submissions will be emailed to this address', max_length=255)), + ('from_address', models.CharField(blank=True, max_length=255)), + ('subject', models.CharField(blank=True, max_length=255)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='PageWithOldStyleRouteMethod', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ('content', models.TextField()), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='RoutablePageTest', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ], + options={ + 'abstract': False, + }, + bases=(wagtail.contrib.wagtailroutablepage.models.RoutablePageMixin, 'wagtailcore.page'), + ), + migrations.CreateModel( + name='SearchTest', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('title', models.CharField(max_length=255)), + ('content', models.TextField()), + ('live', models.BooleanField(default=False)), + ('published_date', models.DateField(null=True)), + ], + options={ + }, + bases=(models.Model, wagtail.wagtailsearch.index.Indexed), + ), + migrations.CreateModel( + name='SearchTestChild', + fields=[ + ('searchtest_ptr', models.OneToOneField(parent_link=True, to='tests.SearchTest', serialize=False, auto_created=True, primary_key=True)), + ('subtitle', models.CharField(null=True, blank=True, max_length=255)), + ('extra_content', models.TextField()), + ], + options={ + }, + bases=('tests.searchtest',), + ), + migrations.CreateModel( + name='SearchTestOldConfig', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ], + options={ + }, + bases=(models.Model, wagtail.wagtailsearch.index.Indexed), + ), + migrations.CreateModel( + name='SearchTestOldConfigList', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ], + options={ + }, + bases=(models.Model, wagtail.wagtailsearch.index.Indexed), + ), + migrations.CreateModel( + name='SimplePage', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ('content', models.TextField()), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='StandardChild', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='StandardIndex', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='TaggedPage', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, to='wagtailcore.Page', serialize=False, auto_created=True, primary_key=True)), + ], + options={ + 'abstract': False, + }, + bases=('wagtailcore.page',), + ), + migrations.CreateModel( + name='TaggedPageTag', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('content_object', modelcluster.fields.ParentalKey(to='tests.TaggedPage', related_name='tagged_items')), + ('tag', models.ForeignKey(to='taggit.Tag', related_name='tests_taggedpagetag_items')), + ], + options={ + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ZuluSnippet', + fields=[ + ('id', models.AutoField(auto_created=True, verbose_name='ID', primary_key=True, serialize=False)), + ('text', models.CharField(max_length=255)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.AddField( + model_name='taggedpage', + name='tags', + field=modelcluster.tags.ClusterTaggableManager(through='tests.TaggedPageTag', blank=True, verbose_name='Tags', to='taggit.Tag', help_text='A comma-separated list of tags.'), + preserve_default=True, + ), + migrations.AddField( + model_name='formfield', + name='page', + field=modelcluster.fields.ParentalKey(to='tests.FormPage', related_name='form_fields'), + preserve_default=True, + ), + migrations.AddField( + model_name='eventpagespeaker', + name='link_page', + field=models.ForeignKey(related_name='+', blank=True, to='wagtailcore.Page', null=True), + preserve_default=True, + ), + migrations.AddField( + model_name='eventpagespeaker', + name='page', + field=modelcluster.fields.ParentalKey(to='tests.EventPage', related_name='speakers'), + preserve_default=True, + ), + migrations.AddField( + model_name='eventpagerelatedlink', + name='link_page', + field=models.ForeignKey(related_name='+', blank=True, to='wagtailcore.Page', null=True), + preserve_default=True, + ), + migrations.AddField( + model_name='eventpagerelatedlink', + name='page', + field=modelcluster.fields.ParentalKey(to='tests.EventPage', related_name='related_links'), + preserve_default=True, + ), + migrations.AddField( + model_name='eventpagecarouselitem', + name='link_page', + field=models.ForeignKey(related_name='+', blank=True, to='wagtailcore.Page', null=True), + preserve_default=True, + ), + migrations.AddField( + model_name='eventpagecarouselitem', + name='page', + field=modelcluster.fields.ParentalKey(to='tests.EventPage', related_name='carousel_items'), + preserve_default=True, + ), + migrations.AddField( + model_name='advertplacement', + name='page', + field=modelcluster.fields.ParentalKey(to='wagtailcore.Page', related_name='advert_placements'), + preserve_default=True, + ), + migrations.AlterField( + model_name='customuser', + name='groups', + field=models.ManyToManyField(related_name='user_set', blank=True, verbose_name='groups', to='auth.Group', related_query_name='user', help_text='The groups this user belongs to. A user will get all permissions granted to each of his/her group.'), + ), + migrations.AlterField( + model_name='customuser', + name='user_permissions', + field=models.ManyToManyField(related_name='user_set', blank=True, verbose_name='user permissions', to='auth.Permission', related_query_name='user', help_text='Specific permissions for this user.'), + ), + ] diff --git a/wagtail/tests/migrations/__init__.py b/wagtail/tests/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtail/tests/models.py b/wagtail/tests/models.py index a38d889bd..0fc74441e 100644 --- a/wagtail/tests/models.py +++ b/wagtail/tests/models.py @@ -17,7 +17,7 @@ from wagtail.wagtailimages.edit_handlers import ImageChooserPanel from wagtail.wagtaildocs.edit_handlers import DocumentChooserPanel from wagtail.wagtailforms.models import AbstractEmailForm, AbstractFormField from wagtail.wagtailsnippets.models import register_snippet -from wagtail.wagtailsearch import indexed +from wagtail.wagtailsearch import index from wagtail.contrib.wagtailroutablepage.models import RoutablePage @@ -228,8 +228,11 @@ class EventPage(Page): related_name='+' ) - indexed_fields = ('get_audience_display', 'location', 'body') - search_name = "Event" + search_fields = ( + index.SearchField('get_audience_display'), + index.SearchField('location'), + index.SearchField('body'), + ) password_required_template = 'tests/event_page_password_required.html' @@ -387,19 +390,19 @@ class BusinessChild(Page): subpage_types = [] -class SearchTest(models.Model, indexed.Indexed): +class SearchTest(models.Model, index.Indexed): title = models.CharField(max_length=255) content = models.TextField() live = models.BooleanField(default=False) published_date = models.DateField(null=True) search_fields = [ - indexed.SearchField('title', partial_match=True), - indexed.SearchField('content'), - indexed.SearchField('callable_indexed_field'), - indexed.FilterField('title'), - indexed.FilterField('live'), - indexed.FilterField('published_date'), + index.SearchField('title', partial_match=True), + index.SearchField('content'), + index.SearchField('callable_indexed_field'), + index.FilterField('title'), + index.FilterField('live'), + index.FilterField('published_date'), ] def callable_indexed_field(self): @@ -411,40 +414,11 @@ class SearchTestChild(SearchTest): extra_content = models.TextField() search_fields = SearchTest.search_fields + [ - indexed.SearchField('subtitle', partial_match=True), - indexed.SearchField('extra_content'), + index.SearchField('subtitle', partial_match=True), + index.SearchField('extra_content'), ] -class SearchTestOldConfig(models.Model, indexed.Indexed): - """ - This tests that the Indexed class can correctly handle models that - use the old "indexed_fields" configuration format. - """ - indexed_fields = { - # A search field with predictive search and boosting - 'title': { - 'type': 'string', - 'analyzer': 'edgengram_analyzer', - 'boost': 100, - }, - - # A filter field - 'live': { - 'type': 'boolean', - 'index': 'not_analyzed', - }, - } - - -class SearchTestOldConfigList(models.Model, indexed.Indexed): - """ - This tests that the Indexed class can correctly handle models that - use the old "indexed_fields" configuration format using a list. - """ - indexed_fields = ['title', 'content'] - - def routable_page_external_view(request, arg): return HttpResponse("EXTERNAL VIEW: " + arg) diff --git a/wagtail/tests/settings.py b/wagtail/tests/settings.py index 1ef1c5ab1..e9c1172b4 100644 --- a/wagtail/tests/settings.py +++ b/wagtail/tests/settings.py @@ -1,5 +1,6 @@ import os +import django from django.conf import global_settings @@ -57,7 +58,6 @@ INSTALLED_APPS = [ 'django.contrib.admin', 'taggit', - 'south', 'compressor', 'wagtail.wagtailcore', @@ -68,7 +68,6 @@ INSTALLED_APPS = [ 'wagtail.wagtailimages', 'wagtail.wagtailembeds', 'wagtail.wagtailsearch', - 'wagtail.wagtailredirects', 'wagtail.wagtailforms', 'wagtail.contrib.wagtailstyleguide', 'wagtail.contrib.wagtailsitemaps', @@ -76,6 +75,27 @@ INSTALLED_APPS = [ 'wagtail.tests', ] +# If we are using Django 1.6, add South to INSTALLED_APPS +if django.VERSION < (1, 7): + INSTALLED_APPS.append('south') + + +# If we are using Django 1.7 install wagtailredirects with its appconfig +# Theres nothing special about wagtailredirects, we just need to have one +# app which uses AppConfigs to test that hooks load properly + +if django.VERSION < (1, 7): + INSTALLED_APPS.append('wagtail.wagtailredirects') +else: + INSTALLED_APPS.append('wagtail.wagtailredirects.apps.WagtailRedirectsAppConfig') + +# As we don't have south migrations for tests, South thinks +# the Django 1.7 migrations are South migrations. +SOUTH_MIGRATION_MODULES = { + 'tests': 'ignore', +} + + # Using DatabaseCache to make sure that the cache is cleared between tests. # This prevents false-positives in some wagtail core tests where we are # changing the 'wagtail_root_paths' key which may cause future tests to fail. diff --git a/wagtail/utils/apps.py b/wagtail/utils/apps.py new file mode 100644 index 000000000..2bee7484e --- /dev/null +++ b/wagtail/utils/apps.py @@ -0,0 +1,35 @@ +try: + from importlib import import_module +except ImportError: + # for Python 2.6, fall back on django.utils.importlib (deprecated as of Django 1.7) + from django.utils.importlib import import_module + +import django +from django.conf import settings +from django.utils.module_loading import module_has_submodule + + +def get_app_modules(): + """ + Generator function that yields a module object for each installed app + yields tuples of (app_name, module) + """ + if django.VERSION < (1, 7): + # Django 1.6 + for app in settings.INSTALLED_APPS: + yield app, import_module(app) + else: + # Django 1.7+ + from django.apps import apps + for app in apps.get_app_configs(): + yield app.name, app.module + + +def get_app_submodules(submodule_name): + """ + Searches each app module for the specified submodule + yields tuples of (app_name, module) + """ + for name, module in get_app_modules(): + if module_has_submodule(module, submodule_name): + yield name, import_module('%s.%s' % (name, submodule_name)) diff --git a/wagtail/utils/deprecation.py b/wagtail/utils/deprecation.py index 24dc4e589..6b4765a5e 100644 --- a/wagtail/utils/deprecation.py +++ b/wagtail/utils/deprecation.py @@ -1,6 +1,10 @@ -class RemovedInWagtail06Warning(DeprecationWarning): +class RemovedInWagtail07Warning(DeprecationWarning): pass -class RemovedInWagtail07Warning(PendingDeprecationWarning): +class RemovedInWagtail08Warning(PendingDeprecationWarning): + pass + + +class RemovedInWagtail08Warning(PendingDeprecationWarning): pass diff --git a/wagtail/wagtailadmin/__init__.py b/wagtail/wagtailadmin/__init__.py index e69de29bb..c0779fd93 100644 --- a/wagtail/wagtailadmin/__init__.py +++ b/wagtail/wagtailadmin/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.wagtailadmin.apps.WagtailAdminAppConfig' diff --git a/wagtail/wagtailadmin/apps.py b/wagtail/wagtailadmin/apps.py new file mode 100644 index 000000000..c963dadef --- /dev/null +++ b/wagtail/wagtailadmin/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailAdminAppConfig(AppConfig): + name = 'wagtail.wagtailadmin' + label = 'wagtailadmin' + verbose_name = "Wagtail admin" diff --git a/wagtail/wagtailadmin/edit_handlers.py b/wagtail/wagtailadmin/edit_handlers.py index d2eb181c3..3e463523d 100644 --- a/wagtail/wagtailadmin/edit_handlers.py +++ b/wagtail/wagtailadmin/edit_handlers.py @@ -491,7 +491,11 @@ class BasePageChooserPanel(BaseChooserPanel): except ValueError: raise ImproperlyConfigured("The page_type passed to PageChooserPanel must be of the form 'app_label.model_name'") - page_type = get_model(app_label, model_name) + try: + page_type = get_model(app_label, model_name) + except LookupError: + page_type = None + if page_type is None: raise ImproperlyConfigured("PageChooserPanel refers to model '%s' that has not been installed" % cls.page_type) else: diff --git a/wagtail/wagtailadmin/hooks.py b/wagtail/wagtailadmin/hooks.py deleted file mode 100644 index 8c8a2374a..000000000 --- a/wagtail/wagtailadmin/hooks.py +++ /dev/null @@ -1,14 +0,0 @@ -# The 'hooks' module is now part of wagtailcore. -# Imports are provided here for backwards compatibility - -import warnings - -from wagtail.utils.deprecation import RemovedInWagtail06Warning - - -warnings.warn( - "The wagtail.wagtailadmin.hooks module has been moved. " - "Use wagtail.wagtailcore.hooks instead.", RemovedInWagtail06Warning) - - -from wagtail.wagtailcore.hooks import register, get_hooks diff --git a/wagtail/wagtailadmin/locale/pt_PT/LC_MESSAGES/django.mo b/wagtail/wagtailadmin/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 000000000..6568f80a9 Binary files /dev/null and b/wagtail/wagtailadmin/locale/pt_PT/LC_MESSAGES/django.mo differ diff --git a/wagtail/wagtailadmin/locale/pt_PT/LC_MESSAGES/django.po b/wagtail/wagtailadmin/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 000000000..cb6f0a69e --- /dev/null +++ b/wagtail/wagtailadmin/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,1127 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Translators: +# Douglas Miranda <douglasmirandasilva@gmail.com>, 2014 +# Gladson <gladsonbrito@gmail.com>, 2014 +msgid "" +msgstr "" +"Project-Id-Version: Wagtail 0.5.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-01 16:38+0100\n" +"PO-Revision-Date: 2014-08-03 01:50+0100\n" +"Last-Translator: Jose Lourenco <jose@lourenco.ws>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pt_PT\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 1.5.4\n" + +#: edit_handlers.py:627 +msgid "Scheduled publishing" +msgstr "Publicação agendada" + +#: edit_handlers.py:641 +msgid "Common page configuration" +msgstr "Configuração comum de página" + +#: forms.py:19 +msgid "Search term" +msgstr "Procurar termo" + +#: forms.py:43 +msgid "Enter your username" +msgstr "Introduza o seu nome de utilizador" + +#: forms.py:46 +msgid "Enter password" +msgstr "Introduza a sua senha" + +#: forms.py:51 +msgid "Enter your email address to reset your password" +msgstr "Introduza o seu email para alterar a sua senha" + +#: forms.py:60 +msgid "Please fill your email address." +msgstr "Por favor, insira o seu e-mail." + +#: forms.py:73 +msgid "" +"Sorry, you cannot reset your password here as your user account is managed " +"by another server." +msgstr "" +"Desculpe, você não pode alterar a sua senha aqui porque a sua conta de " +"utilizador é gerida por outro servidor." + +#: forms.py:76 +msgid "This email address is not recognised." +msgstr "Este email não é reconhecido." + +#: forms.py:88 +msgid "New title" +msgstr "Novo título" + +#: forms.py:89 +msgid "New slug" +msgstr "Novo endereço" + +#: forms.py:95 +msgid "Copy subpages" +msgstr "Copiar sub-páginas" + +#: forms.py:97 +#, python-format +msgid "This will copy %(count)s subpage." +msgid_plural "This will copy %(count)s subpages." +msgstr[0] "Será copiada %(count)s sub-página." +msgstr[1] "Serão copiadas %(count)s sub-páginas." + +#: forms.py:106 +msgid "Publish copied page" +msgstr "Publicar página copiada" + +#: forms.py:107 +msgid "This page is live. Would you like to publish its copy as well?" +msgstr "Esta página está publicada. Gostaria de publicar também a sua cópia?" + +#: forms.py:109 +msgid "Publish copies" +msgstr "Publicar cópias" + +#: forms.py:111 +#, python-format +msgid "" +"%(count)s of the pages being copied is live. Would you like to publish its " +"copy?" +msgid_plural "" +"%(count)s of the pages being copied are live. Would you like to publish " +"their copies?" +msgstr[0] "" +"%(count)s das páginas a copiar estão publicadas. Gostaria de publicar " +"também a sua cópia?" +msgstr[1] "" +"%(count)s das páginas a copiar estão publicadas. Gostaria de publicar " +"também as suas cópias?" + +#: forms.py:124 views/pages.py:155 views/pages.py:272 +msgid "This slug is already in use" +msgstr "Esse endereço já existe" + +#: forms.py:130 templates/wagtailadmin/pages/_privacy_indicator.html:13 +#: templates/wagtailadmin/pages/_privacy_indicator.html:18 +msgid "Public" +msgstr "Público" + +#: forms.py:131 +msgid "Private, accessible with the following password" +msgstr "Privado, acessível com a seguinte senha" + +#: forms.py:139 +msgid "This field is required." +msgstr "Este campo é obrigatório." + +#: templates/wagtailadmin/base.html:7 templates/wagtailadmin/home.html:4 +msgid "Dashboard" +msgstr "Painel de controlo" + +#: templates/wagtailadmin/base.html:27 +msgid "Menu" +msgstr "Menu" + +#: templates/wagtailadmin/home.html:22 +#, python-format +msgid "Welcome to the %(site_name)s Wagtail CMS" +msgstr "Bem vindo ao %(site_name)s Wagtail CMS" + +#: templates/wagtailadmin/home.html:33 +msgid "" +"This is your dashboard on which helpful information about content you've " +"created will be displayed." +msgstr "" +"Este é o seu painel de controlo no qual serão mostradas informações úteis " +"sobre os conteúdos criados por si." + +#: templates/wagtailadmin/login.html:4 templates/wagtailadmin/login.html:59 +msgid "Sign in" +msgstr "Entrar" + +#: templates/wagtailadmin/login.html:18 +msgid "Your username and password didn't match. Please try again." +msgstr "O seu nome de utilizador ou senha não estão corretos. Tente novamente." + +#: templates/wagtailadmin/login.html:26 +msgid "Sign in to Wagtail" +msgstr "Entrar no Wagtail" + +#: templates/wagtailadmin/login.html:46 +msgid "Forgotten it?" +msgstr "Esqueceu-a?" + +#: templates/wagtailadmin/account/account.html:4 +#: templates/wagtailadmin/account/account.html:6 +msgid "Account" +msgstr "Conta" + +#: templates/wagtailadmin/account/account.html:13 +msgid "Set gravatar" +msgstr "Atribuir gravatar" + +#: templates/wagtailadmin/account/account.html:17 +msgid "" +"Your avatar image is provided by Gravatar and is connected to your email " +"address. With a Gravatar account you can set an avatar for any number of " +"other email addresses you use." +msgstr "" +"A sua imagem avatar é fornecida por Gravatar e está associada ao seu email. " +"Com uma conta do Gravatar você pode definir uma imagem avatar para qualquer " +"número de emails que você use." + +#: templates/wagtailadmin/account/account.html:25 +#: templates/wagtailadmin/account/change_password.html:4 +#: templates/wagtailadmin/account/change_password.html:6 +msgid "Change password" +msgstr "Alterar senha" + +#: templates/wagtailadmin/account/account.html:29 +msgid "Change the password you use to log in." +msgstr "Altere a senha que utiliza para entrar." + +#: templates/wagtailadmin/account/account.html:36 +msgid "Notification preferences" +msgstr "Preferências de notificação" + +#: templates/wagtailadmin/account/account.html:40 +msgid "Choose which email notifications to receive." +msgstr "Escolha quais as notificações de email a receber." + +#: templates/wagtailadmin/account/change_password.html:18 +msgid "Change Password" +msgstr "Alterar Senha" + +#: templates/wagtailadmin/account/change_password.html:21 +msgid "" +"Your password can't be changed here. Please contact a site administrator." +msgstr "A sua senha não pode ser alterada. Contacte um administrador do site." + +#: templates/wagtailadmin/account/notification_preferences.html:4 +#: templates/wagtailadmin/account/notification_preferences.html:6 +msgid "Notification Preferences" +msgstr "Preferências de notificação" + +#: templates/wagtailadmin/account/notification_preferences.html:16 +msgid "Update" +msgstr "Atualizar" + +#: templates/wagtailadmin/account/password_reset/complete.html:4 +#: templates/wagtailadmin/account/password_reset/confirm.html:42 +#: templates/wagtailadmin/account/password_reset/done.html:4 +#: templates/wagtailadmin/account/password_reset/form.html:4 +#: templates/wagtailadmin/account/password_reset/form.html:37 +msgid "Reset password" +msgstr "Alterar senha" + +#: templates/wagtailadmin/account/password_reset/complete.html:15 +msgid "Password change successful" +msgstr "Senha alterada com sucesso" + +#: templates/wagtailadmin/account/password_reset/complete.html:16 +msgid "Login" +msgstr "Login" + +#: templates/wagtailadmin/account/password_reset/confirm.html:4 +#: templates/wagtailadmin/account/password_reset/confirm.html:26 +msgid "Set your new password" +msgstr "Insira a sua nova senha" + +#: templates/wagtailadmin/account/password_reset/confirm.html:19 +msgid "The passwords do not match. Please try again." +msgstr "As senhas são diferentes. Tente novamente." + +#: templates/wagtailadmin/account/password_reset/done.html:15 +msgid "Check your email" +msgstr "Verifique o seu email" + +#: templates/wagtailadmin/account/password_reset/done.html:16 +msgid "A link to reset your password has been emailed to you." +msgstr "Um link para alterar a sua senha foi-lhe enviado para o seu email." + +#: templates/wagtailadmin/account/password_reset/email.txt:2 +msgid "Please follow the link below to reset your password" +msgstr "Por favor clique no link abaixo para alterar a sua senha" + +#: templates/wagtailadmin/account/password_reset/email_subject.txt:2 +msgid "Password reset" +msgstr "Alterar senha" + +#: templates/wagtailadmin/account/password_reset/form.html:27 +msgid "Reset your password" +msgstr "Alterar a sua senha" + +#: templates/wagtailadmin/chooser/_link_types.html:5 +#: templates/wagtailadmin/chooser/_link_types.html:7 +msgid "Internal link" +msgstr "Link interno" + +#: templates/wagtailadmin/chooser/_link_types.html:11 +#: templates/wagtailadmin/chooser/_link_types.html:13 +msgid "External link" +msgstr "Link externo" + +#: templates/wagtailadmin/chooser/_link_types.html:17 +#: templates/wagtailadmin/chooser/_link_types.html:19 +msgid "Email link" +msgstr "Link de email" + +#: templates/wagtailadmin/chooser/_search_form.html:7 +#: templates/wagtailadmin/pages/search.html:3 +#: templates/wagtailadmin/pages/search.html:16 +#: templatetags/wagtailadmin_tags.py:36 +msgid "Search" +msgstr "Procurar" + +#: templates/wagtailadmin/chooser/_search_results.html:3 +#: templatetags/wagtailadmin_tags.py:35 +msgid "Explorer" +msgstr "Explorador" + +#: templates/wagtailadmin/chooser/_search_results.html:8 +#, python-format +msgid "" +"\n" +" There is one match\n" +" " +msgid_plural "" +"\n" +" There are %(counter)s matches\n" +" " +msgstr[0] "" +"\n" +" Existe uma correspondência\n" +" " +msgstr[1] "" +"\n" +" Existem %(counter)s correspondências\n" +" " + +#: templates/wagtailadmin/chooser/browse.html:2 +#: templates/wagtailadmin/chooser/search.html:2 +#: templates/wagtailadmin/edit_handlers/page_chooser_panel.html:13 +msgid "Choose a page" +msgstr "Escolher uma página" + +#: templates/wagtailadmin/chooser/email_link.html:2 +msgid "Add an email link" +msgstr "Adicionar link de email" + +#: templates/wagtailadmin/chooser/email_link.html:14 +#: templates/wagtailadmin/chooser/external_link.html:14 +msgid "Insert link" +msgstr "Inserir link" + +#: templates/wagtailadmin/chooser/external_link.html:2 +msgid "Add an external link" +msgstr "Adicionar link externo" + +#: templates/wagtailadmin/edit_handlers/chooser_panel.html:20 +msgid "Clear choice" +msgstr "Limpar escolha" + +#: templates/wagtailadmin/edit_handlers/chooser_panel.html:22 +msgid "Choose another item" +msgstr "Escolher outro item" + +#: templates/wagtailadmin/edit_handlers/chooser_panel.html:27 +msgid "Choose an item" +msgstr "Escolher um item" + +#: templates/wagtailadmin/edit_handlers/inline_panel_child.html:5 +msgid "Move up" +msgstr "Mover para cima" + +#: templates/wagtailadmin/edit_handlers/inline_panel_child.html:6 +msgid "Move down" +msgstr "Mover para baixo" + +#: templates/wagtailadmin/edit_handlers/inline_panel_child.html:8 +#: templates/wagtailadmin/pages/confirm_delete.html:7 +#: templates/wagtailadmin/pages/edit.html:45 +#: templates/wagtailadmin/pages/list.html:84 +#: templates/wagtailadmin/pages/list.html:205 +msgid "Delete" +msgstr "Eliminar" + +#: templates/wagtailadmin/edit_handlers/page_chooser_panel.html:12 +msgid "Choose another page" +msgstr "Escolher outra página" + +#: templates/wagtailadmin/home/pages_for_moderation.html:5 +msgid "Pages awaiting moderation" +msgstr "Páginas a aguardar moderação" + +#: templates/wagtailadmin/home/pages_for_moderation.html:13 +#: templates/wagtailadmin/home/recent_edits.html:12 +#: templates/wagtailadmin/pages/list.html:121 +#: templates/wagtailadmin/pages/list.html:124 +msgid "Title" +msgstr "Título" + +#: templates/wagtailadmin/home/pages_for_moderation.html:14 +#: templates/wagtailadmin/pages/list.html:22 +msgid "Parent" +msgstr "Ascendente (pai)" + +#: templates/wagtailadmin/home/pages_for_moderation.html:15 +#: templates/wagtailadmin/pages/list.html:24 +#: templates/wagtailadmin/pages/list.html:133 +#: templates/wagtailadmin/pages/list.html:136 +msgid "Type" +msgstr "Tipo" + +#: templates/wagtailadmin/home/pages_for_moderation.html:16 +msgid "Edited" +msgstr "Editado" + +#: templates/wagtailadmin/home/pages_for_moderation.html:23 +#: templates/wagtailadmin/home/recent_edits.html:21 +#: templates/wagtailadmin/pages/list.html:176 +#: templates/wagtailadmin/pages/list.html:190 +msgid "Edit this page" +msgstr "Editar esta página" + +#: templates/wagtailadmin/home/pages_for_moderation.html:28 +#: templates/wagtailadmin/pages/_moderator_userbar.html:12 +#: templates/wagtailadmin/userbar/item_page_approve.html:8 +msgid "Approve" +msgstr "Aprovar" + +#: templates/wagtailadmin/home/pages_for_moderation.html:34 +#: templates/wagtailadmin/pages/_moderator_userbar.html:17 +#: templates/wagtailadmin/userbar/item_page_reject.html:8 +msgid "Reject" +msgstr "Rejeitar" + +#: templates/wagtailadmin/home/pages_for_moderation.html:37 +#: templates/wagtailadmin/home/recent_edits.html:23 +#: templates/wagtailadmin/pages/_moderator_userbar.html:9 +#: templates/wagtailadmin/pages/list.html:72 +#: templates/wagtailadmin/pages/list.html:190 +#: templates/wagtailadmin/userbar/item_page_edit.html:5 +msgid "Edit" +msgstr "Editar" + +#: templates/wagtailadmin/home/pages_for_moderation.html:38 +#: templates/wagtailadmin/pages/create.html:41 +#: templates/wagtailadmin/pages/edit.html:56 +#: templates/wagtailadmin/pages/preview.html:5 +msgid "Preview" +msgstr "Pre-visualizar" + +#: templates/wagtailadmin/home/recent_edits.html:5 +msgid "Your most recent edits" +msgstr "Suas últimas edições" + +#: templates/wagtailadmin/home/recent_edits.html:13 +msgid "Date" +msgstr "Data" + +#: templates/wagtailadmin/home/recent_edits.html:14 +#: templates/wagtailadmin/pages/edit.html:18 +#: templates/wagtailadmin/pages/list.html:25 +#: templates/wagtailadmin/pages/list.html:142 +#: templates/wagtailadmin/pages/list.html:145 +msgid "Status" +msgstr "Estado" + +#: templates/wagtailadmin/home/recent_edits.html:25 +#: templates/wagtailadmin/pages/list.html:75 +#: templates/wagtailadmin/pages/list.html:193 +msgid "Draft" +msgstr "Rascunho" + +#: templates/wagtailadmin/home/recent_edits.html:28 +#: templates/wagtailadmin/pages/list.html:78 +#: templates/wagtailadmin/pages/list.html:196 +msgid "Live" +msgstr "Publicado" + +#: templates/wagtailadmin/home/site_summary.html:3 +msgid "Site summary" +msgstr "Resumo do Site" + +#: templates/wagtailadmin/home/site_summary.html:7 +#, python-format +msgid "" +"\n" +" <span>%(total_pages)s</span> Page\n" +" " +msgid_plural "" +"\n" +" <span>%(total_pages)s</span> Pages\n" +" " +msgstr[0] "" +"\n" +" <span>%(total_pages)s</span> Página\n" +" " +msgstr[1] "" +"\n" +" <span>%(total_pages)s</span> Páginas\n" +" " + +#: templates/wagtailadmin/home/site_summary.html:16 +#, python-format +msgid "" +"\n" +" <span>%(total_images)s</span> Image\n" +" " +msgid_plural "" +"\n" +" <span>%(total_images)s</span> Images\n" +" " +msgstr[0] "" +"\n" +" <span>%(total_images)s</span> Imagem\n" +" " +msgstr[1] "" +"\n" +" <span>%(total_images)s</span> Imagens\n" +" " + +#: templates/wagtailadmin/home/site_summary.html:25 +#, python-format +msgid "" +"\n" +" <span>%(total_docs)s</span> Document\n" +" " +msgid_plural "" +"\n" +" <span>%(total_docs)s</span> Documents\n" +" " +msgstr[0] "" +"\n" +" <span>%(total_docs)s</span> Documento\n" +" " +msgstr[1] "" +"\n" +" <span>%(total_docs)s</span> Documentos\n" +" " + +#: templates/wagtailadmin/notifications/approved.html:1 +#, python-format +msgid "The page \"%(title)s\" has been approved" +msgstr "A página \"%(title)s\" foi aprovada" + +#: templates/wagtailadmin/notifications/approved.html:2 +#, python-format +msgid "The page \"%(title)s\" has been approved." +msgstr "A página \"%(title)s\" foi aprovada." + +#: templates/wagtailadmin/notifications/approved.html:4 +msgid "You can view the page here:" +msgstr "Pode visualizar a página aqui:" + +#: templates/wagtailadmin/notifications/base_notification.html:3 +msgid "Edit your notification preferences here:" +msgstr "Edite as suas preferências de notificação aqui:" + +#: templates/wagtailadmin/notifications/rejected.html:1 +#, python-format +msgid "The page \"%(title)s\" has been rejected" +msgstr "A página \"%(title)s\" foi rejeitada" + +#: templates/wagtailadmin/notifications/rejected.html:2 +#, python-format +msgid "The page \"%(title)s\" has been rejected." +msgstr "A página \"%(title)s\" foi rejeitada" + +#: templates/wagtailadmin/notifications/rejected.html:4 +#: templates/wagtailadmin/notifications/submitted.html:5 +msgid "You can edit the page here:" +msgstr "Você pode editar a página aqui:" + +#: templates/wagtailadmin/notifications/submitted.html:1 +#, python-format +msgid "The page \"%(page)s\" has been submitted for moderation" +msgstr "A página \"%(page)s\" foi enviada para moderação" + +#: templates/wagtailadmin/notifications/submitted.html:2 +#, python-format +msgid "The page \"%(page)s\" has been submitted for moderation." +msgstr "A página \"%(page)s\" foi enviada para moderação." + +#: templates/wagtailadmin/notifications/submitted.html:4 +msgid "You can preview the page here:" +msgstr "Pode pre-visualizar a página aqui:" + +#: templates/wagtailadmin/page_privacy/ancestor_privacy.html:2 +#: templates/wagtailadmin/page_privacy/set_privacy.html:2 +msgid "Page privacy" +msgstr "Privacidade da página" + +#: templates/wagtailadmin/page_privacy/ancestor_privacy.html:6 +msgid "This page has been made private by a parent page." +msgstr "Esta página foi classificada como privada por uma página ascendente" + +#: templates/wagtailadmin/page_privacy/ancestor_privacy.html:7 +msgid "You can edit the privacy settings on:" +msgstr "Você pode editar as configurações de privacidade em:" + +#: templates/wagtailadmin/page_privacy/set_privacy.html:6 +msgid "<b>Note:</b> privacy changes apply to all children of this page too." +msgstr "" +"<b>Nota:</b> as alterações de privacidade também serão aplicadas a todas as " +"páginas filhas desta página." + +#: templates/wagtailadmin/pages/_moderator_userbar.html:4 +#, python-format +msgid "" +"\n" +" Previewing '%(title)s', submitted by %(submitted_by)s on " +"%(submitted_on)s.\n" +" " +msgstr "" +"\n" +" Pre-visualizando '%(title)s', enviado por %(submitted_by)s em " +"%(submitted_on)s.\n" +" " + +#: templates/wagtailadmin/pages/_privacy_indicator.html:9 +msgid "Privacy" +msgstr "Privacidade" + +#: templates/wagtailadmin/pages/_privacy_indicator.html:14 +#: templates/wagtailadmin/pages/_privacy_indicator.html:20 +msgid "Private" +msgstr "Privada" + +#: templates/wagtailadmin/pages/add_subpage.html:6 +#, python-format +msgid "Create a page in %(title)s" +msgstr "Criar uma página em %(title)s" + +#: templates/wagtailadmin/pages/add_subpage.html:9 +msgid "Create a page in" +msgstr "Criar uma página em" + +#: templates/wagtailadmin/pages/add_subpage.html:13 +msgid "Choose which type of page you'd like to create." +msgstr "Escolha o tipo de página que gostaria de criar." + +#: templates/wagtailadmin/pages/add_subpage.html:26 +#, python-format +msgid "Pages using %(page_type)s" +msgstr "Páginas usando %(page_type)s" + +#: templates/wagtailadmin/pages/confirm_delete.html:3 +#, python-format +msgid "Delete %(title)s" +msgstr "Eliminar %(title)s" + +#: templates/wagtailadmin/pages/confirm_delete.html:12 +msgid "Are you sure you want to delete this page?" +msgstr "Tem certeza que deseja eliminar esta página?" + +#: templates/wagtailadmin/pages/confirm_delete.html:14 +#, python-format +msgid "" +"\n" +" This will also delete one more subpage.\n" +" " +msgid_plural "" +"\n" +" This will also delete %(descendant_count)s more " +"subpages.\n" +" " +msgstr[0] "" +"\n" +" Isto também eliminará uma ou mais sub-páginas.\n" +" " +msgstr[1] "" +"\n" +" Isto também eliminará mais %(descendant_count)s sub-" +"páginas.\n" +" " + +#: templates/wagtailadmin/pages/confirm_delete.html:22 +msgid "" +"Alternatively you can unpublish the page. This removes the page from public " +"view and you can edit or publish it again later." +msgstr "" +"Em alternativa, poderá despublicar a página. Assim, a página deixará de " +"estar visível publicamente, podendo você voltar a editá-la ou publicá-la " +"mais tarde." + +#: templates/wagtailadmin/pages/confirm_delete.html:26 +msgid "Delete it" +msgstr "Eliminá-la" + +#: templates/wagtailadmin/pages/confirm_delete.html:26 +msgid "Unpublish it" +msgstr "Despublicá-la" + +#: templates/wagtailadmin/pages/confirm_move.html:3 +#, python-format +msgid "Move %(title)s" +msgstr "Mover %(title)s" + +#: templates/wagtailadmin/pages/confirm_move.html:6 +#: templates/wagtailadmin/pages/list.html:81 +#: templates/wagtailadmin/pages/list.html:199 +msgid "Move" +msgstr "Mover" + +#: templates/wagtailadmin/pages/confirm_move.html:11 +#, python-format +msgid "Are you sure you want to move this page into '%(title)s'?" +msgstr "Tem certeza que deseja mover esta página para dentro de '%(title)s'?" + +#: templates/wagtailadmin/pages/confirm_move.html:13 +#, python-format +msgid "" +"Are you sure you want to move this page and all of its children into " +"'%(title)s'?" +msgstr "" +"Tem a certeza que deseja mover esta página e todas as suas páginas filhas " +"para dentro de '%(title)s'?" + +#: templates/wagtailadmin/pages/confirm_move.html:18 +msgid "Yes, move this page" +msgstr "Sim, mover esta página" + +#: templates/wagtailadmin/pages/confirm_unpublish.html:3 +#, python-format +msgid "Unpublish %(title)s" +msgstr "Despublicar %(title)s" + +#: templates/wagtailadmin/pages/confirm_unpublish.html:6 +#: templates/wagtailadmin/pages/edit.html:42 +#: templates/wagtailadmin/pages/list.html:87 +#: templates/wagtailadmin/pages/list.html:208 +msgid "Unpublish" +msgstr "Despublicar" + +#: templates/wagtailadmin/pages/confirm_unpublish.html:10 +msgid "Are you sure you want to unpublish this page?" +msgstr "Tem certeza que deseja despublicar esta página?" + +#: templates/wagtailadmin/pages/confirm_unpublish.html:13 +msgid "Yes, unpublish it" +msgstr "Sim, quero despublicar" + +#: templates/wagtailadmin/pages/content_type_use.html:7 +msgid "Pages using" +msgstr "Páginas usando" + +#: templates/wagtailadmin/pages/copy.html:3 +#, python-format +msgid "Copy %(title)s" +msgstr "Copiar %(title)s" + +#: templates/wagtailadmin/pages/copy.html:6 +#: templates/wagtailadmin/pages/list.html:202 +msgid "Copy" +msgstr "Copiar" + +#: templates/wagtailadmin/pages/copy.html:26 +msgid "Copy this page" +msgstr "Copiar esta página" + +#: templates/wagtailadmin/pages/create.html:5 +#, python-format +msgid "New %(page_type)s" +msgstr "Nova %(page_type)s" + +#: templates/wagtailadmin/pages/create.html:15 +msgid "New" +msgstr "Nova" + +#: templates/wagtailadmin/pages/create.html:29 +msgid "Save as draft" +msgstr "Guardar como rascunho" + +#: templates/wagtailadmin/pages/create.html:33 +#: templates/wagtailadmin/pages/edit.html:48 +msgid "Publish" +msgstr "Publicar" + +#: templates/wagtailadmin/pages/create.html:35 +#: templates/wagtailadmin/pages/edit.html:50 +msgid "Submit for moderation" +msgstr "Enviar para moderação" + +#: templates/wagtailadmin/pages/edit.html:5 +#, python-format +msgid "Editing %(title)s" +msgstr "Editando %(title)s" + +#: templates/wagtailadmin/pages/edit.html:15 +#, python-format +msgid "Editing <span>%(title)s</span>" +msgstr "Editando <span>%(title)s</span>" + +#: templates/wagtailadmin/pages/edit.html:38 +msgid "Save draft" +msgstr "Guardar rascunho" + +#: templates/wagtailadmin/pages/edit.html:77 +#, python-format +msgid "Last modified: %(last_mod)s" +msgstr "Última modificação: %(last_mod)s" + +#: templates/wagtailadmin/pages/edit.html:79 +#, python-format +msgid "by %(modified_by)s" +msgstr "por %(modified_by)s" + +#: templates/wagtailadmin/pages/index.html:3 +#, python-format +msgid "Exploring %(title)s" +msgstr "Explorando %(title)s" + +#: templates/wagtailadmin/pages/list.html:90 +#: templates/wagtailadmin/pages/list.html:211 +msgid "Add child page" +msgstr "Adicionar página filha" + +#: templates/wagtailadmin/pages/list.html:112 +msgid "Disable ordering of child pages" +msgstr "Desativar ordenação de páginas filhas" + +#: templates/wagtailadmin/pages/list.html:112 +#: templates/wagtailadmin/pages/list.html:114 +msgid "Order" +msgstr "Ordem" + +#: templates/wagtailadmin/pages/list.html:114 +msgid "Enable ordering of child pages" +msgstr "Ativar ordenação de páginas filhas" + +#: templates/wagtailadmin/pages/list.html:158 +msgid "Drag" +msgstr "Arrastar" + +#: templates/wagtailadmin/pages/list.html:237 +#: templates/wagtailadmin/pages/list.html:241 +#, python-format +msgid "Explorer subpages of '%(title)s'" +msgstr "Explorar sub-páginas de %(title)s" + +#: templates/wagtailadmin/pages/list.html:237 +#: templates/wagtailadmin/pages/list.html:241 +#: templates/wagtailadmin/pages/list.html:245 +msgid "Explore" +msgstr "Explorar" + +#: templates/wagtailadmin/pages/list.html:245 +#, python-format +msgid "Explore child pages of '%(title)s'" +msgstr "Explorar as páginas filhas de '%(title)s'" + +#: templates/wagtailadmin/pages/list.html:247 +#, python-format +msgid "Add a child page to '%(title)s'" +msgstr "Adicionar página filha a %(title)s" + +#: templates/wagtailadmin/pages/list.html:247 +msgid "Add subpage" +msgstr "Adicionar sub-página" + +#: templates/wagtailadmin/pages/list.html:256 +msgid "No pages have been created." +msgstr "Nenhuma página foi criada." + +#: templates/wagtailadmin/pages/list.html:256 +#, python-format +msgid "Why not <a href=\"%(add_page_url)s\">add one</a>?" +msgstr "Porque não <a href=\"%(add_page_url)s\">adicionar uma</a>?" + +#: templates/wagtailadmin/pages/list.html:263 +#, python-format +msgid "" +"\n" +" Page %(page_number)s of %(num_pages)s.\n" +" " +msgstr "" +"\n" +" Página %(page_number)s de %(num_pages)s.\n" +" " + +#: templates/wagtailadmin/pages/list.html:269 +#: templates/wagtailadmin/pages/search_results.html:35 +#: templates/wagtailadmin/pages/search_results.html:37 +#: templates/wagtailadmin/pages/usage_results.html:13 +#: templates/wagtailadmin/shared/pagination_nav.html:21 +#: templates/wagtailadmin/shared/pagination_nav.html:23 +#: templates/wagtailadmin/shared/pagination_nav.html:25 +msgid "Previous" +msgstr "Anterior" + +#: templates/wagtailadmin/pages/list.html:274 +#: templates/wagtailadmin/pages/search_results.html:44 +#: templates/wagtailadmin/pages/search_results.html:46 +#: templates/wagtailadmin/pages/usage_results.html:18 +#: templates/wagtailadmin/shared/pagination_nav.html:32 +#: templates/wagtailadmin/shared/pagination_nav.html:34 +#: templates/wagtailadmin/shared/pagination_nav.html:36 +msgid "Next" +msgstr "Próxima" + +#: templates/wagtailadmin/pages/move_choose_destination.html:3 +#, python-format +msgid "Select a new parent page for %(title)s" +msgstr "Selecione uma nova página ascendente para %(title)s" + +#: templates/wagtailadmin/pages/move_choose_destination.html:7 +#, python-format +msgid "Select a new parent page for <span>%(title)s</span>" +msgstr "Selecione uma nova página ascendente para <span>%(title)s</span>" + +#: templates/wagtailadmin/pages/search_results.html:6 +#, python-format +msgid "" +"\n" +" There is one matching page\n" +" " +msgid_plural "" +"\n" +" There are %(counter)s matching pages\n" +" " +msgstr[0] "" +"\n" +" Existe uma página correspondente\n" +" " +msgstr[1] "" +"\n" +" Existem %(counter)s páginas correspondentes\n" +" " + +#: templates/wagtailadmin/pages/search_results.html:16 +msgid "Other searches" +msgstr "Outras pesquisas" + +#: templates/wagtailadmin/pages/search_results.html:18 +msgid "Images" +msgstr "Imagens" + +#: templates/wagtailadmin/pages/search_results.html:19 +msgid "Documents" +msgstr "Documentos" + +#: templates/wagtailadmin/pages/search_results.html:20 +msgid "Users" +msgstr "Utilizadores" + +#: templates/wagtailadmin/pages/search_results.html:28 +#: templates/wagtailadmin/pages/usage_results.html:7 +#, python-format +msgid "" +"\n" +" Page %(page_number)s of %(num_pages)s.\n" +" " +msgstr "" +"\n" +" Página %(page_number)s de %(num_pages)s.\n" +" " + +#: templates/wagtailadmin/pages/search_results.html:54 +#, python-format +msgid "Sorry, no pages match <em>\"%(query_string)s\"</em>" +msgstr "Desculpe, nenhuma página satisfaz <em>\"%(query_string)s\"</em>" + +#: templates/wagtailadmin/pages/search_results.html:56 +msgid "Enter a search term above" +msgstr "Introduza um termo de pesquisa acima" + +#: templates/wagtailadmin/pages/usage_results.html:24 +msgid "No pages use" +msgstr "Nenhuma página usa" + +#: templates/wagtailadmin/shared/breadcrumb.html:6 +msgid "Home" +msgstr "Início" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:6 +msgid "January" +msgstr "Janeiro" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:7 +msgid "February" +msgstr "Fevereiro" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:8 +msgid "March" +msgstr "Março" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:9 +msgid "April" +msgstr "Abril" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:10 +msgid "May" +msgstr "Maio" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:11 +msgid "June" +msgstr "Junho" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:12 +msgid "July" +msgstr "Julho" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:13 +msgid "August" +msgstr "Agosto" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:14 +msgid "September" +msgstr "Setembro" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:15 +msgid "October" +msgstr "Outubro" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:16 +msgid "November" +msgstr "Novembro" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:17 +msgid "December" +msgstr "Dezembro" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:20 +msgid "Sun" +msgstr "Dom" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:21 +msgid "Mon" +msgstr "Seg" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:22 +msgid "Tue" +msgstr "Ter" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:23 +msgid "Wed" +msgstr "Qua" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:24 +msgid "Thu" +msgstr "Qui" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:25 +msgid "Fri" +msgstr "Sex" + +#: templates/wagtailadmin/shared/datetimepicker_translations.html:26 +msgid "Sat" +msgstr "Sáb" + +#: templates/wagtailadmin/shared/header.html:23 +#, python-format +msgid "Used %(useage_count)s time" +msgid_plural "Used %(useage_count)s times" +msgstr[0] "Em uso %(useage_count)s time" +msgstr[1] "Em uso %(useage_count)s times" + +#: templates/wagtailadmin/shared/main_nav.html:10 +msgid "Account settings" +msgstr "Configurações da Conta" + +#: templates/wagtailadmin/shared/main_nav.html:11 +msgid "Log out" +msgstr "Sair" + +#: templates/wagtailadmin/shared/pagination_nav.html:16 +#, python-format +msgid "Page %(page_num)s of %(total_pages)s." +msgstr "Página %(page_num)s de %(total_pages)s." + +#: templates/wagtailadmin/userbar/base.html:4 +msgid "User bar" +msgstr "Barra de utilizador" + +#: templates/wagtailadmin/userbar/base.html:14 +msgid "Go to Wagtail admin interface" +msgstr "Ir para a página admin do Wagtail" + +#: templates/wagtailadmin/userbar/item_page_add.html:5 +msgid "Add another page at this level" +msgstr "Adicionar outra página a este nível" + +#: templates/wagtailadmin/userbar/item_page_add.html:5 +msgid "Add" +msgstr "Adicionar" + +#: views/account.py:39 +msgid "Your password has been changed successfully!" +msgstr "A sua senha foi alterada com sucesso!" + +#: views/account.py:60 +msgid "Your preferences have been updated successfully!" +msgstr "As suas preferências foram atualizadas com sucesso!" + +#: views/pages.py:169 views/pages.py:286 +msgid "Go live date/time must be before expiry date/time" +msgstr "A data/hora de publicação tem de ser anterior à data/hora terminal" + +#: views/pages.py:179 views/pages.py:296 +msgid "Expiry date/time must be in the future" +msgstr "A data/hora terminal tem de ocorrer no futuro" + +#: views/pages.py:219 views/pages.py:351 views/pages.py:791 +msgid "Page '{0}' published." +msgstr "Página '{0}' publicada." + +#: views/pages.py:221 views/pages.py:353 +msgid "Page '{0}' submitted for moderation." +msgstr "Página '{0}' enviada para moderação." + +#: views/pages.py:224 +msgid "Page '{0}' created." +msgstr "Página '{0}' criada." + +#: views/pages.py:233 +msgid "The page could not be created due to validation errors" +msgstr "Esta página não pôde ser criada devido a erros na validação" + +#: views/pages.py:356 +msgid "Page '{0}' updated." +msgstr "Página '{0}' atualizada." + +#: views/pages.py:365 +msgid "The page could not be saved due to validation errors" +msgstr "A página não pôde ser guardada devido a erros na validação" + +#: views/pages.py:378 +msgid "This page is currently awaiting moderation" +msgstr "Essa página aguarda por moderação" + +#: views/pages.py:409 +msgid "Page '{0}' deleted." +msgstr "Página '{0}' eliminada." + +#: views/pages.py:575 +msgid "Page '{0}' unpublished." +msgstr "Página '{0}' despublicada." + +#: views/pages.py:627 +msgid "Page '{0}' moved." +msgstr "Página '{0}' movida." + +#: views/pages.py:709 +msgid "Page '{0}' and {1} subpages copied." +msgstr "Página '{0}' e {1} sub-páginas copiadas." + +#: views/pages.py:711 +msgid "Page '{0}' copied." +msgstr "Página '{0}' copiada." + +#: views/pages.py:785 views/pages.py:804 views/pages.py:824 +msgid "The page '{0}' is not currently awaiting moderation." +msgstr "A página '{0}' já não está aguarda moderação." + +#: views/pages.py:810 +msgid "Page '{0}' rejected for publication." +msgstr "Página '{0}' rejeitada para publicação." diff --git a/wagtail/wagtailadmin/migrations/0001_create_admin_access_permissions.py b/wagtail/wagtailadmin/migrations/0001_create_admin_access_permissions.py new file mode 100644 index 000000000..5f198a01d --- /dev/null +++ b/wagtail/wagtailadmin/migrations/0001_create_admin_access_permissions.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +def create_admin_access_permissions(apps, schema_editor): + ContentType = apps.get_model('contenttypes.ContentType') + Permission = apps.get_model('auth.Permission') + Group = apps.get_model('auth.Group') + + # Add a fake content type to hang the 'can access Wagtail admin' permission off. + # The fact that this doesn't correspond to an actual defined model shouldn't matter, I hope... + wagtailadmin_content_type = ContentType.objects.create( + app_label='wagtailadmin', + model='admin', + name='Wagtail admin' + ) + + # Create admin permission + admin_permission = Permission.objects.create( + content_type=wagtailadmin_content_type, + codename='access_admin', + name='Can access Wagtail admin' + ) + + # Assign it to Editors and Moderators groups + for group in Group.objects.filter(name__in=['Editors', 'Moderators']): + group.permissions.add(admin_permission) + + +class Migration(migrations.Migration): + + dependencies = [ + # Need to run wagtailcores initial data migration to make sure the groups are created + ('wagtailcore', '0002_initial_data'), + ] + + operations = [ + migrations.RunPython(create_admin_access_permissions), + ] diff --git a/wagtail/wagtailadmin/migrations/__init__.py b/wagtail/wagtailadmin/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtail/wagtailadmin/static/wagtailadmin/js/vendor/modernizr-2.6.2.min.js b/wagtail/wagtailadmin/static/wagtailadmin/js/vendor/modernizr-2.6.2.min.js index 7eb2abe75..f18b5c2c9 100644 --- a/wagtail/wagtailadmin/static/wagtailadmin/js/vendor/modernizr-2.6.2.min.js +++ b/wagtail/wagtailadmin/static/wagtailadmin/js/vendor/modernizr-2.6.2.min.js @@ -1,4 +1,4 @@ /* Modernizr 2.8.3 (Custom Build) | MIT & BSD - * Build: http://modernizr.com/download/#-cssanimations-cssreflections-csstransforms-csstransforms3d-csstransitions-draganddrop-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-file_api-load + * Build: http://modernizr.com/download/#-cssanimations-cssreflections-csstransforms-csstransforms3d-csstransitions-draganddrop-touch-shiv-mq-cssclasses-addtest-prefixed-teststyles-testprop-testallprops-hasevent-prefixes-domprefixes-file_api-load */ -;window.Modernizr=function(a,b,c){function B(a){j.cssText=a}function C(a,b){return B(m.join(a+";")+(b||""))}function D(a,b){return typeof a===b}function E(a,b){return!!~(""+a).indexOf(b)}function F(a,b){for(var d in a){var e=a[d];if(!E(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function G(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:D(f,"function")?f.bind(d||b):f}return!1}function H(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return D(b,"string")||D(b,"undefined")?F(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),G(e,b,c))}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b)&&c(b).matches||!1;var d;return w("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},y=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=D(e[d],"function"),D(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),z={}.hasOwnProperty,A;!D(z,"undefined")&&!D(z.call,"undefined")?A=function(a,b){return z.call(a,b)}:A=function(a,b){return b in a&&D(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},q.cssanimations=function(){return H("animationName")},q.cssreflections=function(){return H("boxReflect")},q.csstransforms=function(){return!!H("transform")},q.csstransforms3d=function(){var a=!!H("perspective");return a&&"webkitPerspective"in g.style&&w("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},q.csstransitions=function(){return H("transition")};for(var I in q)A(q,I)&&(v=I.toLowerCase(),e[v]=q[I](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)A(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},B(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function q(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?o(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function r(a){a||(a=b);var c=n(a);return s.shivCSS&&!g&&!c.hasCSS&&(c.hasCSS=!!l(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||q(a,c),a}var c="3.7.0",d=a.html5||{},e=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,f=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g,h="_html5shiv",i=0,j={},k;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.mq=x,e.hasEvent=y,e.testProp=function(a){return F([a])},e.testAllProps=H,e.testStyles=w,e.prefixed=function(a,b,c){return b?H(a,b,c):H(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))},Modernizr.addTest("filereader",function(){return!!(window.File&&window.FileList&&window.FileReader)}); \ No newline at end of file +;window.Modernizr=function(a,b,c){function B(a){j.cssText=a}function C(a,b){return B(m.join(a+";")+(b||""))}function D(a,b){return typeof a===b}function E(a,b){return!!~(""+a).indexOf(b)}function F(a,b){for(var d in a){var e=a[d];if(!E(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function G(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:D(f,"function")?f.bind(d||b):f}return!1}function H(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return D(b,"string")||D(b,"undefined")?F(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),G(e,b,c))}var d="2.8.3",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["­",'<style id="s',h,'">',a,"</style>"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x=function(b){var c=a.matchMedia||a.msMatchMedia;if(c)return c(b)&&c(b).matches||!1;var d;return w("@media "+b+" { #"+h+" { position: absolute; } }",function(b){d=(a.getComputedStyle?getComputedStyle(b,null):b.currentStyle)["position"]=="absolute"}),d},y=function(){function d(d,e){e=e||b.createElement(a[d]||"div"),d="on"+d;var f=d in e;return f||(e.setAttribute||(e=b.createElement("div")),e.setAttribute&&e.removeAttribute&&(e.setAttribute(d,""),f=D(e[d],"function"),D(e[d],"undefined")||(e[d]=c),e.removeAttribute(d))),e=null,f}var a={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return d}(),z={}.hasOwnProperty,A;!D(z,"undefined")&&!D(z.call,"undefined")?A=function(a,b){return z.call(a,b)}:A=function(a,b){return b in a&&D(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:w(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},q.draganddrop=function(){var a=b.createElement("div");return"draggable"in a||"ondragstart"in a&&"ondrop"in a},q.cssanimations=function(){return H("animationName")},q.cssreflections=function(){return H("boxReflect")},q.csstransforms=function(){return!!H("transform")},q.csstransforms3d=function(){var a=!!H("perspective");return a&&"webkitPerspective"in g.style&&w("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},q.csstransitions=function(){return H("transition")};for(var I in q)A(q,I)&&(v=I.toLowerCase(),e[v]=q[I](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)A(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},B(""),i=k=null,function(a,b){function l(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function m(){var a=s.elements;return typeof a=="string"?a.split(" "):a}function n(a){var b=j[a[h]];return b||(b={},i++,a[h]=i,j[i]=b),b}function o(a,c,d){c||(c=b);if(k)return c.createElement(a);d||(d=n(c));var g;return d.cache[a]?g=d.cache[a].cloneNode():f.test(a)?g=(d.cache[a]=d.createElem(a)).cloneNode():g=d.createElem(a),g.canHaveChildren&&!e.test(a)&&!g.tagUrn?d.frag.appendChild(g):g}function p(a,c){a||(a=b);if(k)return a.createDocumentFragment();c=c||n(a);var d=c.frag.cloneNode(),e=0,f=m(),g=f.length;for(;e<g;e++)d.createElement(f[e]);return d}function q(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return s.shivMethods?o(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(s,b.frag)}function r(a){a||(a=b);var c=n(a);return s.shivCSS&&!g&&!c.hasCSS&&(c.hasCSS=!!l(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),k||q(a,c),a}var c="3.7.0",d=a.html5||{},e=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,f=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,g,h="_html5shiv",i=0,j={},k;(function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",g="hidden"in a,k=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){g=!0,k=!0}})();var s={elements:d.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:c,shivCSS:d.shivCSS!==!1,supportsUnknownElements:k,shivMethods:d.shivMethods!==!1,type:"default",shivDocument:r,createElement:o,createDocumentFragment:p};a.html5=s,r(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.mq=x,e.hasEvent=y,e.testProp=function(a){return F([a])},e.testAllProps=H,e.testStyles=w,e.prefixed=function(a,b,c){return b?H(a,b,c):H(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f<d;f++)g=a[f].split("="),(e=z[g.shift()])&&(c=e(c,g));for(f=0;f<b;f++)c=x[f](c);return c}function g(a,e,f,g,h){var i=b(a),j=i.autoCallback;i.url.split(".").pop().split("?").shift(),i.bypass||(e&&(e=d(e)?e:e[a]||e[g]||e[a.split("/").pop().split("?")[0]]),i.instead?i.instead(a,e,f,g,h):(y[i.url]?i.noexec=!0:y[i.url]=1,f.load(i.url,i.forceCSS||!i.forceJS&&"css"==i.url.split(".").pop().split("?").shift()?"c":c,i.noexec,i.attrs,i.timeout),(d(e)||d(j))&&f.load(function(){k(),e&&e(i.origUrl,h,g),j&&j(i.origUrl,h,g),y[i.url]=2})))}function h(a,b){function c(a,c){if(a){if(e(a))c||(j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}),g(a,j,b,0,h);else if(Object(a)===a)for(n in m=function(){var b=0,c;for(c in a)a.hasOwnProperty(c)&&b++;return b}(),a)a.hasOwnProperty(n)&&(!c&&!--m&&(d(j)?j=function(){var a=[].slice.call(arguments);k.apply(this,a),l()}:j[n]=function(a){return function(){var b=[].slice.call(arguments);a&&a.apply(this,b),l()}}(k[n])),g(a[n],j,b,n,h))}else!c&&l()}var h=!!a.test,i=a.load||a.both,j=a.callback||f,k=j,l=a.complete||f,m,n;c(h?a.yep:a.nope,!!i),i&&c(i)}var i,j,l=this.yepnope.loader;if(e(a))g(a,0,l,0);else if(w(a))for(i=0;i<a.length;i++)j=a[i],e(j)?g(j,0,l,0):w(j)?B(j):Object(j)===j&&h(j,l);else Object(a)===a&&h(a,l)},B.addPrefix=function(a,b){z[a]=b},B.addFilter=function(a){x.push(a)},B.errorTimeout=1e4,null==b.readyState&&b.addEventListener&&(b.readyState="loading",b.addEventListener("DOMContentLoaded",A=function(){b.removeEventListener("DOMContentLoaded",A,0),b.readyState="complete"},0)),a.yepnope=k(),a.yepnope.executeStack=h,a.yepnope.injectJs=function(a,c,d,e,i,j){var k=b.createElement("script"),l,o,e=e||B.errorTimeout;k.src=a;for(o in d)k.setAttribute(o,d[o]);c=j?h:c||f,k.onreadystatechange=k.onload=function(){!l&&g(k.readyState)&&(l=1,c(),k.onload=k.onreadystatechange=null)},m(function(){l||(l=1,c(1))},e),i?k.onload():n.parentNode.insertBefore(k,n)},a.yepnope.injectCss=function(a,c,d,e,g,i){var e=b.createElement("link"),j,c=i?h:c||f;e.href=a,e.rel="stylesheet",e.type="text/css";for(j in d)e.setAttribute(j,d[j]);g||(n.parentNode.insertBefore(e,n),m(c,0))}}(this,document),Modernizr.load=function(){yepnope.apply(window,[].slice.call(arguments,0))},Modernizr.addTest("filereader",function(){return!!(window.File&&window.FileList&&window.FileReader)}); \ No newline at end of file diff --git a/wagtail/wagtailadmin/static/wagtailadmin/scss/components/typography.scss b/wagtail/wagtailadmin/static/wagtailadmin/scss/components/typography.scss index 1b7e36324..059392aaf 100644 --- a/wagtail/wagtailadmin/static/wagtailadmin/scss/components/typography.scss +++ b/wagtail/wagtailadmin/static/wagtailadmin/scss/components/typography.scss @@ -56,7 +56,6 @@ kbd{ /* Help text formatters */ .help-block{ - float:left; padding:1em; margin:1em 0; clear:both; diff --git a/wagtail/wagtailadmin/taggable.py b/wagtail/wagtailadmin/taggable.py index 3b7de479c..ce8698231 100644 --- a/wagtail/wagtailadmin/taggable.py +++ b/wagtail/wagtailadmin/taggable.py @@ -4,19 +4,19 @@ from django.contrib.contenttypes.models import ContentType from django.db.models import Count from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger -from wagtail.wagtailsearch import indexed +from wagtail.wagtailsearch import index from wagtail.wagtailsearch.backends import get_search_backend -class TagSearchable(indexed.Indexed): +class TagSearchable(index.Indexed): """ Mixin to provide a 'search' method, searching on the 'title' field and tags, for models that provide those things. """ search_fields = ( - indexed.SearchField('title', partial_match=True, boost=10), - indexed.SearchField('get_tags', partial_match=True, boost=10) + index.SearchField('title', partial_match=True, boost=10), + index.SearchField('get_tags', partial_match=True, boost=10) ) @property diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_results.html b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_results.html index 6f575259e..62f911bf0 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_results.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/_search_results.html @@ -1,11 +1,19 @@ {% load i18n %} + +{% if page_types_restricted %} + <p class="help-block help-warning"> + {% blocktrans with type=page_type.get_verbose_name %} + Only pages of type "{{ type }}" may be chosen for this field. Search results will exclude pages of other types. + {% endblocktrans %} + </p> +{% endif %} + {% if not is_searching %} <h2>{% trans "Explorer" %}</h2> {% include "wagtailadmin/shared/breadcrumb.html" with page=parent_page choosing=1 %} - {% else %} <h2> - {% blocktrans count counter=pages.count %} + {% blocktrans count counter=pages|length %} There is one match {% plural %} There are {{ counter }} matches @@ -13,8 +21,10 @@ </h2> {% endif %} -{% if is_searching %} - {% include "wagtailadmin/pages/list.html" with choosing=1 show_parent=1 pages=pages parent_page=parent_page %} -{% else %} - {% include "wagtailadmin/pages/list.html" with choosing=1 allow_navigation=1 orderable=0 pages=pages parent_page=parent_page %} +{% if pages %} + {% if is_searching %} + {% include "wagtailadmin/pages/list.html" with choosing=1 show_parent=1 pages=pages parent_page=parent_page %} + {% else %} + {% include "wagtailadmin/pages/list.html" with choosing=1 allow_navigation=1 orderable=0 pages=pages parent_page=parent_page %} + {% endif %} {% endif %} \ No newline at end of file diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/browse.html b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/browse.html index 5714ddb45..98f758204 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/chooser/browse.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/chooser/browse.html @@ -1,13 +1,17 @@ {% load i18n %} -{% trans "Choose a page" as choose_str %} -{% include "wagtailadmin/shared/header.html" with title=choose_str search_url="wagtailadmin_choose_page" icon="doc-empty-inverse" %} +{% if page_types_restricted %} + {% trans "Choose" as choose_str %} + {% trans page_type.get_verbose_name as subtitle %} +{% else %} + {% trans "Choose a page" as choose_str %} +{% endif %} + +{% include "wagtailadmin/shared/header.html" with title=choose_str subtitle=subtitle search_url="wagtailadmin_choose_page" query_parameters="page_type="|add:page_type_string icon="doc-empty-inverse" %} <div class="nice-padding"> {% include 'wagtailadmin/chooser/_link_types.html' with current='internal' %} <div class="page-results"> - {# content in here will be replaced by live search results #} - {% include 'wagtailadmin/chooser/_search_results.html' %} </div> </div> diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/page_privacy/set_privacy.html b/wagtail/wagtailadmin/templates/wagtailadmin/page_privacy/set_privacy.html index 6298d6f5f..263908a26 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/page_privacy/set_privacy.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/page_privacy/set_privacy.html @@ -3,7 +3,7 @@ {% include "wagtailadmin/shared/header.html" with title=title_str icon="locked" %} <div class="nice-padding"> - <p>{% trans "<b>Note:</b> privacy changes apply to all children of this page too." %}</p> + <p class="help-block help-warning">{% trans "Privacy changes apply to all children of this page too." %}</p> <form action="{% url 'wagtailadmin_pages_set_privacy' page.id %}" method="POST"> {% csrf_token %} <ul class="fields"> diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/shared/header.html b/wagtail/wagtailadmin/templates/wagtailadmin/shared/header.html index fa790960d..6d394d499 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/shared/header.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/shared/header.html @@ -6,7 +6,7 @@ <h1 class="icon icon-{{ icon }}">{{ title }} <span>{{ subtitle }}</span></h1> </div> {% if search_url %} - <form class="col search-form" action="{% url search_url %}" method="get"> + <form class="col search-form" action="{% url search_url %}{% if query_parameters %}?{{ query_parameters }}{% endif %}" method="get"> <ul class="fields"> {% for field in search_form %} {% include "wagtailadmin/shared/field_as_li.html" with field=field field_classes="field-small iconfield" input_classes="icon-search" %} diff --git a/wagtail/wagtailadmin/templatetags/wagtailuserbar.py b/wagtail/wagtailadmin/templatetags/wagtailuserbar.py index c7861185e..2846d9506 100644 --- a/wagtail/wagtailadmin/templatetags/wagtailuserbar.py +++ b/wagtail/wagtailadmin/templatetags/wagtailuserbar.py @@ -3,8 +3,6 @@ import warnings from django import template from django.template.loader import render_to_string -from wagtail.utils.deprecation import RemovedInWagtail06Warning - from wagtail.wagtailcore.models import Page @@ -12,13 +10,7 @@ register = template.Library() @register.simple_tag(takes_context=True) -def wagtailuserbar(context, css_path=None): - if css_path is not None: - warnings.warn( - "Passing a CSS path to the wagtailuserbar tag is no longer required; use {% wagtailuserbar %} instead", - RemovedInWagtail06Warning - ) - +def wagtailuserbar(context): # Find request object request = context['request'] diff --git a/wagtail/wagtailadmin/tests/test_edit_handlers.py b/wagtail/wagtailadmin/tests/test_edit_handlers.py index 8b499378c..eaedccc2c 100644 --- a/wagtail/wagtailadmin/tests/test_edit_handlers.py +++ b/wagtail/wagtailadmin/tests/test_edit_handlers.py @@ -43,9 +43,6 @@ class TestGetFormForModel(TestCase): class TestExtractPanelDefinitionsFromModelClass(TestCase): - class FakePage(Page): - pass - def test_can_extract_panels(self): mock = MagicMock() mock.panels = 'foo' @@ -58,7 +55,7 @@ class TestExtractPanelDefinitionsFromModelClass(TestCase): self.assertNotEqual(panel.field_name, 'hostname') def test_extracted_objects_are_panels(self): - panels = extract_panel_definitions_from_model_class(self.FakePage) + panels = extract_panel_definitions_from_model_class(Page) for panel in panels: self.assertTrue(issubclass(panel, BaseFieldPanel)) @@ -346,11 +343,27 @@ class TestInlinePanel(TestCase): fake_page = self.FakePage() self.barbecue = fake_page + class FakePanel(object): + name = 'mock panel' + + class FakeChild(object): + def render_js(self): + return "rendered js" + + def rendered_fields(self): + return ["rendered fields"] + + def init(*args, **kwargs): + pass + + def __call__(self, *args, **kwargs): + fake_child = self.FakeChild() + return fake_child + def setUp(self): self.fake_field = self.FakeField() self.fake_instance = self.FakeInstance() - self.mock_panel = MagicMock() - self.mock_panel.name = 'mock panel' + self.mock_panel = self.FakePanel() self.mock_model = MagicMock() self.mock_model.formset.related.model.panels = [self.mock_panel] diff --git a/wagtail/wagtailadmin/views/chooser.py b/wagtail/wagtailadmin/views/chooser.py index 31cad20db..1a2c9a109 100644 --- a/wagtail/wagtailadmin/views/chooser.py +++ b/wagtail/wagtailadmin/views/chooser.py @@ -3,6 +3,7 @@ from django.shortcuts import get_object_or_404, render from django.http import Http404 from django.utils.http import urlencode from django.contrib.auth.decorators import permission_required +from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger from wagtail.wagtailadmin.modal_workflow import render_modal_workflow from wagtail.wagtailadmin.forms import SearchForm, ExternalLinkChooserForm, ExternalLinkChooserWithLinkTextForm, EmailLinkChooserForm, EmailLinkChooserWithLinkTextForm @@ -25,6 +26,7 @@ def browse(request, parent_page_id=None): content_type_app_name, content_type_model_name = page_type.split('.') is_searching = False + page_types_restricted = page_type != 'wagtailcore.page' try: content_type = ContentType.objects.get_by_natural_key(content_type_app_name, content_type_model_name) @@ -66,8 +68,11 @@ def browse(request, parent_page_id=None): return render(request, 'wagtailadmin/chooser/_search_results.html', { 'querystring': get_querystring(request), 'searchform': search_form, - 'pages': pages, - 'is_searching': is_searching + 'pages': shown_pages, + 'is_searching': is_searching, + 'page_type_string': page_type, + 'page_type': desired_class, + 'page_types_restricted': page_types_restricted }) return render_modal_workflow(request, 'wagtailadmin/chooser/browse.html', 'wagtailadmin/chooser/browse.js', { @@ -77,7 +82,10 @@ def browse(request, parent_page_id=None): 'parent_page': parent_page, 'pages': shown_pages, 'search_form': search_form, - 'is_searching': False + 'is_searching': False, + 'page_type_string': page_type, + 'page_type': desired_class, + 'page_types_restricted': page_types_restricted }) diff --git a/wagtail/wagtailadmin/views/pages.py b/wagtail/wagtailadmin/views/pages.py index 3de6f7cb5..a7212cc3e 100644 --- a/wagtail/wagtailadmin/views/pages.py +++ b/wagtail/wagtailadmin/views/pages.py @@ -12,8 +12,6 @@ from django.utils.translation import ugettext as _ from django.views.decorators.http import require_GET from django.views.decorators.vary import vary_on_headers -from wagtail.utils.deprecation import RemovedInWagtail06Warning - from wagtail.wagtailadmin.edit_handlers import TabbedInterface, ObjectList from wagtail.wagtailadmin.forms import SearchForm, CopyForm from wagtail.wagtailadmin import tasks, signals @@ -427,27 +425,6 @@ def view_draft(request, page_id): return page.serve_preview(page.dummy_request(), page.default_preview_mode) -def get_preview_response(page, preview_mode): - """ - Helper function for preview_on_edit and preview_on_create - - return a page's preview response via either serve_preview or the deprecated - show_as_mode method - """ - # Check the deprecated Page.show_as_mode method, as subclasses of Page - # might be overriding that to return a response - response = page.show_as_mode(preview_mode) - if response: - warnings.warn( - "Defining 'show_as_mode' on a page model is deprecated. Use 'serve_preview' instead", - RemovedInWagtail06Warning - ) - return response - else: - # show_as_mode did not return a response, so go ahead and use the 'proper' - # serve_preview method - return page.serve_preview(page.dummy_request(), preview_mode) - - @permission_required('wagtailadmin.access_admin') def preview_on_edit(request, page_id): # Receive the form submission that would typically be posted to the 'edit' view. If submission is valid, @@ -462,8 +439,7 @@ def preview_on_edit(request, page_id): form.save(commit=False) preview_mode = request.GET.get('mode', page.default_preview_mode) - response = get_preview_response(page, preview_mode) - + response = page.serve_preview(page.dummy_request(), preview_mode) response['X-Wagtail-Preview'] = 'ok' return response @@ -507,8 +483,7 @@ def preview_on_create(request, content_type_app_name, content_type_model_name, p page.path = Page._get_children_path_interval(parent_page.path)[1] preview_mode = request.GET.get('mode', page.default_preview_mode) - response = get_preview_response(page, preview_mode) - + response = page.serve_preview(page.dummy_request(), preview_mode) response['X-Wagtail-Preview'] = 'ok' return response diff --git a/wagtail/wagtailcore/__init__.py b/wagtail/wagtailcore/__init__.py index e69de29bb..160f57430 100644 --- a/wagtail/wagtailcore/__init__.py +++ b/wagtail/wagtailcore/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.wagtailcore.apps.WagtailCoreAppConfig' diff --git a/wagtail/wagtailcore/apps.py b/wagtail/wagtailcore/apps.py new file mode 100644 index 000000000..b4ef506dc --- /dev/null +++ b/wagtail/wagtailcore/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailCoreAppConfig(AppConfig): + name = 'wagtail.wagtailcore' + label = 'wagtailcore' + verbose_name = "Wagtail core" diff --git a/wagtail/wagtailcore/hooks.py b/wagtail/wagtailcore/hooks.py index 958675b97..41955b9d3 100644 --- a/wagtail/wagtailcore/hooks.py +++ b/wagtail/wagtailcore/hooks.py @@ -1,9 +1,5 @@ -from django.conf import settings -try: - from importlib import import_module -except ImportError: - # for Python 2.6, fall back on django.utils.importlib (deprecated as of Django 1.7) - from django.utils.importlib import import_module +from wagtail.utils.apps import get_app_submodules + _hooks = {} @@ -40,12 +36,7 @@ _searched_for_hooks = False def search_for_hooks(): global _searched_for_hooks if not _searched_for_hooks: - for app_module in settings.INSTALLED_APPS: - try: - import_module('%s.wagtail_hooks' % app_module) - except ImportError: - continue - + list(get_app_submodules('wagtail_hooks')) _searched_for_hooks = True diff --git a/wagtail/wagtailcore/locale/pt_PT/LC_MESSAGES/django.mo b/wagtail/wagtailcore/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 000000000..51a033d05 Binary files /dev/null and b/wagtail/wagtailcore/locale/pt_PT/LC_MESSAGES/django.mo differ diff --git a/wagtail/wagtailcore/locale/pt_PT/LC_MESSAGES/django.po b/wagtail/wagtailcore/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 000000000..5da56cf9a --- /dev/null +++ b/wagtail/wagtailcore/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,97 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +# Translators: +# Thiago Cangussu <cangussu.thg@gmail.com>, 2014 +msgid "" +msgstr "" +"Project-Id-Version: Wagtail 0.5.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-01 16:38+0100\n" +"PO-Revision-Date: 2014-08-03 01:52+0100\n" +"Last-Translator: Jose Lourenco <jose@lourenco.ws>\n" +"Language-Team: \n" +"Language: pt_PT\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pt_PT\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 1.5.4\n" + +#: models.py:46 +msgid "" +"Set this to something other than 80 if you need a specific port number to " +"appear in URLs (e.g. development on port 8000). Does not affect request " +"handling (so port forwarding still works)." +msgstr "" +"Atribua um valor diferente de 80 se você necessitar que um número de porto " +"específico apareça nas URLs (ex. desenvolvimento no porto 8000). Não afeta o " +"tratamento de requisições (assim, o redirecionamento de portos continua a " +"funcionar)." + +#: models.py:48 +msgid "" +"If true, this site will handle requests for all other hostnames that do not " +"have a site entry of their own" +msgstr "" +"Se verdadeiro, este site irá processar requisições de todos os outros " +"hostnames que não tenham um site próprio" + +#: models.py:109 +#, python-format +msgid "" +"%(hostname)s is already configured as the default site. You must unset that " +"before you can save this site as default." +msgstr "" +"O %(hostname)s já está configurado como site pré-definido. Tem de alterar " +"essa configuração antes de poder guardar este site como pré-definido." + +#: models.py:277 +msgid "The page title as you'd like it to be seen by the public" +msgstr "O título da página como você gostaria que fosse visto pelo público" + +#: models.py:278 +msgid "" +"The name of the page as it will appear in URLs e.g http://domain.com/blog/" +"[my-slug]/" +msgstr "" +"O nome da página como ele irá aparecer nas URLs ex.: http://domain.com/blog/" +"[my-slug]/" + +#: models.py:287 +msgid "Page title" +msgstr "Título da página" + +#: models.py:287 +msgid "" +"Optional. 'Search Engine Friendly' title. This will appear at the top of the " +"browser window." +msgstr "" +"Opcional. Título 'Amigável para Motores de Busca'. Isto irá aparecer no topo " +"da janela do navegador." + +#: models.py:288 +msgid "" +"Whether a link to this page will appear in automatically generated menus" +msgstr "" +"Se um link para esta página irá aparecer nos menus gerados automaticamente" + +#: models.py:291 +msgid "Go live date/time" +msgstr "Data/hora de publicação" + +#: models.py:291 models.py:292 +msgid "Please add a date-time in the form YYYY-MM-DD hh:mm:ss." +msgstr "Por favor adicione uma data-hora no formato AAAA-MM-DD hh:mm:ss." + +#: models.py:292 +msgid "Expiry date/time" +msgstr "Data/hora terminal" + +#: models.py:564 +msgid "name '{0}' (used in subpage_types list) is not defined." +msgstr "" +"O nome '{0}' (usado na lista de tipos de sub-páginas) não está definido." diff --git a/wagtail/wagtailcore/migrations/0001_initial.py b/wagtail/wagtailcore/migrations/0001_initial.py new file mode 100644 index 000000000..304d53322 --- /dev/null +++ b/wagtail/wagtailcore/migrations/0001_initial.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings +import wagtail.wagtailsearch.index + + +class Migration(migrations.Migration): + + dependencies = [ + ('auth', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('contenttypes', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='GroupPagePermission', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)), + ('permission_type', models.CharField(choices=[('add', 'Add'), ('edit', 'Edit'), ('publish', 'Publish')], max_length=20)), + ('group', models.ForeignKey(to='auth.Group', related_name='page_permissions')), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Page', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)), + ('path', models.CharField(max_length=255, unique=True)), + ('depth', models.PositiveIntegerField()), + ('numchild', models.PositiveIntegerField(default=0)), + ('title', models.CharField(max_length=255, help_text="The page title as you'd like it to be seen by the public")), + ('slug', models.SlugField(help_text='The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/')), + ('live', models.BooleanField(default=True, editable=False)), + ('has_unpublished_changes', models.BooleanField(default=False, editable=False)), + ('url_path', models.CharField(blank=True, max_length=255, editable=False)), + ('seo_title', models.CharField(blank=True, max_length=255, help_text="Optional. 'Search Engine Friendly' title. This will appear at the top of the browser window.", verbose_name='Page title')), + ('show_in_menus', models.BooleanField(default=False, help_text='Whether a link to this page will appear in automatically generated menus')), + ('search_description', models.TextField(blank=True)), + ('go_live_at', models.DateTimeField(blank=True, verbose_name='Go live date/time', null=True, help_text='Please add a date-time in the form YYYY-MM-DD hh:mm:ss.')), + ('expire_at', models.DateTimeField(blank=True, verbose_name='Expiry date/time', null=True, help_text='Please add a date-time in the form YYYY-MM-DD hh:mm:ss.')), + ('expired', models.BooleanField(default=False, editable=False)), + ('content_type', models.ForeignKey(to='contenttypes.ContentType', related_name='pages')), + ('owner', models.ForeignKey(blank=True, null=True, to=settings.AUTH_USER_MODEL, editable=False, related_name='owned_pages')), + ], + options={ + 'abstract': False, + }, + bases=(models.Model, wagtail.wagtailsearch.index.Indexed), + ), + migrations.CreateModel( + name='PageRevision', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)), + ('submitted_for_moderation', models.BooleanField(default=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('content_json', models.TextField()), + ('approved_go_live_at', models.DateTimeField(blank=True, null=True)), + ('page', models.ForeignKey(to='wagtailcore.Page', related_name='revisions')), + ('user', models.ForeignKey(blank=True, null=True, to=settings.AUTH_USER_MODEL)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='PageViewRestriction', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)), + ('password', models.CharField(max_length=255)), + ('page', models.ForeignKey(to='wagtailcore.Page', related_name='view_restrictions')), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Site', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)), + ('hostname', models.CharField(max_length=255, db_index=True)), + ('port', models.IntegerField(default=80, help_text='Set this to something other than 80 if you need a specific port number to appear in URLs (e.g. development on port 8000). Does not affect request handling (so port forwarding still works).')), + ('is_default_site', models.BooleanField(default=False, help_text='If true, this site will handle requests for all other hostnames that do not have a site entry of their own')), + ('root_page', models.ForeignKey(to='wagtailcore.Page', related_name='sites_rooted_here')), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.AlterUniqueTogether( + name='site', + unique_together=set([('hostname', 'port')]), + ), + migrations.AddField( + model_name='grouppagepermission', + name='page', + field=models.ForeignKey(to='wagtailcore.Page', related_name='group_permissions'), + preserve_default=True, + ), + ] diff --git a/wagtail/wagtailcore/migrations/0002_initial_data.py b/wagtail/wagtailcore/migrations/0002_initial_data.py new file mode 100644 index 000000000..10244c24c --- /dev/null +++ b/wagtail/wagtailcore/migrations/0002_initial_data.py @@ -0,0 +1,91 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +def initial_data(apps, schema_editor): + ContentType = apps.get_model('contenttypes.ContentType') + Group = apps.get_model('auth.Group') + Page = apps.get_model('wagtailcore.Page') + Site = apps.get_model('wagtailcore.Site') + GroupPagePermission = apps.get_model('wagtailcore.GroupPagePermission') + + # Create page content type + page_content_type, created = ContentType.objects.get_or_create( + model='page', + app_label='wagtailcore', + defaults={'name': 'page'} + ) + + # Create root page + root = Page.objects.create( + title="Root", + slug='root', + content_type=page_content_type, + path='0001', + depth=1, + numchild=1, + url_path='/', + ) + + # Create homepage + homepage = Page.objects.create( + title="Welcome to your new Wagtail site!", + slug='home', + content_type=page_content_type, + path='00010001', + depth=2, + numchild=0, + url_path='/home/', + ) + + # Create default site + Site.objects.create( + hostname='localhost', + root_page_id=homepage.id, + is_default_site=True + ) + + # Create auth groups + moderators_group = Group.objects.create(name='Moderators') + editors_group = Group.objects.create(name='Editors') + + # Create group permissions + GroupPagePermission.objects.create( + group=moderators_group, + page=root, + permission_type='add', + ) + GroupPagePermission.objects.create( + group=moderators_group, + page=root, + permission_type='edit', + ) + GroupPagePermission.objects.create( + group=moderators_group, + page=root, + permission_type='publish', + ) + + GroupPagePermission.objects.create( + group=editors_group, + page=root, + permission_type='add', + ) + GroupPagePermission.objects.create( + group=editors_group, + page=root, + permission_type='edit', + ) + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0001_initial'), + ] + + operations = [ + migrations.RunPython(initial_data), + ] diff --git a/wagtail/wagtailcore/migrations/__init__.py b/wagtail/wagtailcore/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtail/wagtailcore/models.py b/wagtail/wagtailcore/models.py index a237e16e6..9151c98db 100644 --- a/wagtail/wagtailcore/models.py +++ b/wagtail/wagtailcore/models.py @@ -26,13 +26,11 @@ from django.utils.encoding import python_2_unicode_compatible from treebeard.mp_tree import MP_Node -from wagtail.utils.deprecation import RemovedInWagtail06Warning - from wagtail.wagtailcore.utils import camelcase_to_underscore from wagtail.wagtailcore.query import PageQuerySet from wagtail.wagtailcore.url_routing import RouteResult -from wagtail.wagtailsearch import indexed +from wagtail.wagtailsearch import index from wagtail.wagtailsearch.backends import get_search_backend @@ -149,31 +147,6 @@ def get_page_types(): return _PAGE_CONTENT_TYPES -def get_leaf_page_content_type_ids(): - warnings.warn(""" - get_leaf_page_content_type_ids is deprecated, as it treats pages without an explicit subpage_types - setting as 'leaf' pages. Code that calls get_leaf_page_content_type_ids must be rewritten to avoid - this incorrect assumption. - """, RemovedInWagtail06Warning) - return [ - content_type.id - for content_type in get_page_types() - if not getattr(content_type.model_class(), 'subpage_types', None) - ] - -def get_navigable_page_content_type_ids(): - warnings.warn(""" - get_navigable_page_content_type_ids is deprecated, as it treats pages without an explicit subpage_types - setting as 'leaf' pages. Code that calls get_navigable_page_content_type_ids must be rewritten to avoid - this incorrect assumption. - """, RemovedInWagtail06Warning) - return [ - content_type.id - for content_type in get_page_types() - if getattr(content_type.model_class(), 'subpage_types', None) - ] - - class PageManager(models.Manager): def get_queryset(self): return PageQuerySet(self.model).order_by('path') @@ -274,7 +247,7 @@ class PageBase(models.base.ModelBase): @python_2_unicode_compatible -class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, indexed.Indexed)): +class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, index.Indexed)): title = models.CharField(max_length=255, help_text=_("The page title as you'd like it to be seen by the public")) slug = models.SlugField(help_text=_("The name of the page as it will appear in URLs e.g http://domain.com/blog/[my-slug]/")) # TODO: enforce uniqueness on slug field per parent (will have to be done at the Django @@ -294,13 +267,13 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, indexed.Index expired = models.BooleanField(default=False, editable=False) search_fields = ( - indexed.SearchField('title', partial_match=True, boost=100), - indexed.FilterField('id'), - indexed.FilterField('live'), - indexed.FilterField('owner'), - indexed.FilterField('content_type'), - indexed.FilterField('path'), - indexed.FilterField('depth'), + index.SearchField('title', partial_match=True, boost=100), + index.FilterField('id'), + index.FilterField('live'), + index.FilterField('owner'), + index.FilterField('content_type'), + index.FilterField('path'), + index.FilterField('depth'), ) def __init__(self, *args, **kwargs): @@ -476,14 +449,6 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, indexed.Index """ return (not self.is_leaf()) or self.depth == 2 - def get_other_siblings(self): - warnings.warn( - "The 'Page.get_other_siblings()' method has been replaced. " - "Use 'Page.get_siblings(inclusive=False)' instead.", RemovedInWagtail06Warning) - - # get sibling pages excluding self - return self.get_siblings().exclude(id=self.id) - @property def full_url(self): """Return the full URL (including protocol / domain) to this page, or None if it is not routable""" @@ -728,15 +693,6 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, indexed.Index for example, a page containing a form might have a default view of the form, and a post-submission 'thankyou' page """ - modes = self.get_page_modes() - if modes is not Page.DEFAULT_PREVIEW_MODES: - # User has overriden get_page_modes instead of using preview_modes - warnings.warn("Overriding get_page_modes is deprecated. Define a preview_modes property instead", RemovedInWagtail06Warning) - - return modes - - def get_page_modes(self): - # Deprecated accessor for the preview_modes property return Page.DEFAULT_PREVIEW_MODES @property @@ -770,12 +726,6 @@ class Page(six.with_metaclass(PageBase, MP_Node, ClusterableModel, indexed.Index """ return self.serve(request) - def show_as_mode(self, mode_name): - # Deprecated API for rendering previews. If this returns something other than None, - # we know that a subclass of Page has overridden this, and we should try to work with - # that response if possible. - return None - def get_cached_paths(self): """ This returns a list of paths to invalidate in a frontend cache diff --git a/wagtail/wagtailcore/templatetags/pageurl.py b/wagtail/wagtailcore/templatetags/pageurl.py deleted file mode 100644 index 016a77759..000000000 --- a/wagtail/wagtailcore/templatetags/pageurl.py +++ /dev/null @@ -1,11 +0,0 @@ -import warnings - -from wagtail.utils.deprecation import RemovedInWagtail06Warning - - -warnings.warn( - "The pageurl tag library has been moved to wagtailcore_tags. " - "Use {% load wagtailcore_tags %} instead.", RemovedInWagtail06Warning) - - -from wagtail.wagtailcore.templatetags.wagtailcore_tags import register, pageurl diff --git a/wagtail/wagtailcore/templatetags/rich_text.py b/wagtail/wagtailcore/templatetags/rich_text.py deleted file mode 100644 index 09e93d846..000000000 --- a/wagtail/wagtailcore/templatetags/rich_text.py +++ /dev/null @@ -1,11 +0,0 @@ -import warnings - -from wagtail.utils.deprecation import RemovedInWagtail06Warning - - -warnings.warn( - "The rich_text tag library has been moved to wagtailcore_tags. " - "Use {% load wagtailcore_tags %} instead.", RemovedInWagtail06Warning) - - -from wagtail.wagtailcore.templatetags.wagtailcore_tags import register, richtext diff --git a/wagtail/wagtailcore/tests/test_page_model.py b/wagtail/wagtailcore/tests/test_page_model.py index d494b2654..211c8f8a3 100644 --- a/wagtail/wagtailcore/tests/test_page_model.py +++ b/wagtail/wagtailcore/tests/test_page_model.py @@ -4,8 +4,6 @@ from django.test import TestCase, Client from django.test.utils import override_settings from django.http import HttpRequest, Http404 -from wagtail.utils.deprecation import RemovedInWagtail06Warning - from wagtail.wagtailcore.models import Page, Site from wagtail.tests.models import EventPage, EventIndex, SimplePage, PageWithOldStyleRouteMethod @@ -282,24 +280,6 @@ class TestServeView(TestCase): self.assertNotContains(response, '<h1>Events</h1>') self.assertContains(response, '<a href="/events/christmas/">Christmas</a>') - - def test_old_style_routing(self): - """ - Test that route() methods that return an HttpResponse are correctly handled - """ - with warnings.catch_warnings(record=True) as w: - response = self.client.get('/old-style-route/') - - # Check that a RemovedInWagtail06Warning has been triggered - self.assertEqual(len(w), 1) - self.assertTrue(issubclass(w[-1].category, RemovedInWagtail06Warning)) - self.assertTrue("Page.route should return an instance of wagtailcore.url_routing.RouteResult" in str(w[-1].message)) - - expected_page = PageWithOldStyleRouteMethod.objects.get(url_path='/home/old-style-route/') - self.assertEqual(response.status_code, 200) - self.assertEqual(response.context['self'], expected_page) - self.assertEqual(response.templates[0].name, 'tests/simple_page.html') - def test_before_serve_hook(self): response = self.client.get('/events/', HTTP_USER_AGENT='GoogleBot') self.assertContains(response, 'bad googlebot no cookie') diff --git a/wagtail/wagtailcore/util.py b/wagtail/wagtailcore/util.py deleted file mode 100644 index 7bbe82f57..000000000 --- a/wagtail/wagtailcore/util.py +++ /dev/null @@ -1,10 +0,0 @@ -import warnings - -from wagtail.utils.deprecation import RemovedInWagtail06Warning - - -warnings.warn( - "The wagtail.wagtailcore.util module has been renamed. " - "Use wagtail.wagtailcore.utils instead.", RemovedInWagtail06Warning) - -from .utils import * diff --git a/wagtail/wagtailcore/views.py b/wagtail/wagtailcore/views.py index 5daa642b9..f01390b83 100644 --- a/wagtail/wagtailcore/views.py +++ b/wagtail/wagtailcore/views.py @@ -5,8 +5,6 @@ from django.shortcuts import get_object_or_404, redirect from django.core.urlresolvers import reverse from django.conf import settings -from wagtail.utils.deprecation import RemovedInWagtail06Warning - from wagtail.wagtailcore import hooks from wagtail.wagtailcore.models import Page, PageViewRestriction from wagtail.wagtailcore.forms import PasswordPageViewRestrictionForm @@ -19,15 +17,8 @@ def serve(request, path): raise Http404 path_components = [component for component in path.split('/') if component] - route_result = request.site.root_page.specific.route(request, path_components) - if isinstance(route_result, HttpResponse): - warnings.warn( - "Page.route should return an instance of wagtailcore.url_routing.RouteResult, not an HttpResponse", - RemovedInWagtail06Warning - ) - return route_result + page, args, kwargs = request.site.root_page.specific.route(request, path_components) - (page, args, kwargs) = route_result for fn in hooks.get_hooks('before_serve_page'): result = fn(page, request, args, kwargs) if isinstance(result, HttpResponse): diff --git a/wagtail/wagtaildocs/__init__.py b/wagtail/wagtaildocs/__init__.py index e69de29bb..9c5f85240 100644 --- a/wagtail/wagtaildocs/__init__.py +++ b/wagtail/wagtaildocs/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.wagtaildocs.apps.WagtailDocsAppConfig' diff --git a/wagtail/wagtaildocs/apps.py b/wagtail/wagtaildocs/apps.py new file mode 100644 index 000000000..eef820d18 --- /dev/null +++ b/wagtail/wagtaildocs/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailDocsAppConfig(AppConfig): + name = 'wagtail.wagtaildocs' + label = 'wagtaildocs' + verbose_name = "Wagtail documents" diff --git a/wagtail/wagtaildocs/locale/pt_PT/LC_MESSAGES/django.mo b/wagtail/wagtaildocs/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 000000000..2ed7e9aaf Binary files /dev/null and b/wagtail/wagtaildocs/locale/pt_PT/LC_MESSAGES/django.mo differ diff --git a/wagtail/wagtaildocs/locale/pt_PT/LC_MESSAGES/django.po b/wagtail/wagtaildocs/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 000000000..c352afd29 --- /dev/null +++ b/wagtail/wagtaildocs/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,196 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +# Translators: +# Thiago Cangussu <cangussu.thg@gmail.com>, 2014 +msgid "" +msgstr "" +"Project-Id-Version: Wagtail 0.5.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-01 16:38+0100\n" +"PO-Revision-Date: 2014-08-03 01:53+0100\n" +"Last-Translator: Jose Lourenco <jose@lourenco.ws>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 1.5.4\n" +"Language: pt_PT\n" + +#: models.py:21 templates/wagtaildocs/documents/list.html:11 +#: templates/wagtaildocs/documents/list.html:14 +#: templates/wagtaildocs/documents/usage.html:16 +msgid "Title" +msgstr "Título" + +#: models.py:22 templates/wagtaildocs/documents/list.html:17 +msgid "File" +msgstr "Ficheiro" + +#: models.py:26 +msgid "Tags" +msgstr "Etiquetas" + +#: wagtail_hooks.py:24 templates/wagtaildocs/documents/index.html:16 +msgid "Documents" +msgstr "Documentos" + +#: templates/wagtaildocs/chooser/chooser.html:2 +#: templates/wagtaildocs/edit_handlers/document_chooser_panel.html:11 +msgid "Choose a document" +msgstr "Escolher um documento" + +#: templates/wagtaildocs/chooser/chooser.html:7 +#: templates/wagtaildocs/chooser/chooser.html:19 +msgid "Search" +msgstr "Procurar" + +#: templates/wagtaildocs/chooser/chooser.html:8 +msgid "Upload" +msgstr "Enviar" + +#: templates/wagtaildocs/chooser/chooser.html:34 +#: templates/wagtaildocs/documents/add.html:25 +#: templates/wagtaildocs/documents/edit.html:29 +msgid "Save" +msgstr "Guardar" + +#: templates/wagtaildocs/chooser/results.html:5 +#: templates/wagtaildocs/documents/results.html:5 +#, python-format +msgid "" +"\n" +" There is one match\n" +" " +msgid_plural "" +"\n" +" There are %(counter)s matches\n" +" " +msgstr[0] "" +"\n" +" Existe uma correspondência\n" +" " +msgstr[1] "" +"\n" +" Existem %(counter)s correspondências\n" +" " + +#: templates/wagtaildocs/chooser/results.html:12 +msgid "Latest documents" +msgstr "Últimos documentos" + +#: templates/wagtaildocs/chooser/results.html:19 +#: templates/wagtaildocs/documents/results.html:18 +#, python-format +msgid "Sorry, no documents match \"<em>%(query_string)s</em>\"" +msgstr "Desculpe, nenhum documento corresponde a \"<em>%(query_string)s</em>\"" + +#: templates/wagtaildocs/documents/_file_field.html:5 +msgid "Change document:" +msgstr "Alterar documento" + +#: templates/wagtaildocs/documents/add.html:4 +#: templates/wagtaildocs/documents/index.html:17 +msgid "Add a document" +msgstr "Adicionar um documento" + +#: templates/wagtaildocs/documents/add.html:15 +msgid "Add document" +msgstr "Adicionar documento" + +#: templates/wagtaildocs/documents/confirm_delete.html:3 +#, python-format +msgid "Delete %(title)s" +msgstr "Eliminar %(title)s" + +#: templates/wagtaildocs/documents/confirm_delete.html:6 +#: templates/wagtaildocs/documents/edit.html:29 +msgid "Delete document" +msgstr "Eliminar documento" + +#: templates/wagtaildocs/documents/confirm_delete.html:10 +msgid "Are you sure you want to delete this document?" +msgstr "Tem certeza que quer eliminar este documento?" + +#: templates/wagtaildocs/documents/confirm_delete.html:13 +msgid "Yes, delete" +msgstr "Sim, eliminar" + +#: templates/wagtaildocs/documents/edit.html:4 +#, python-format +msgid "Editing %(title)s" +msgstr "Editando %(title)s" + +#: templates/wagtaildocs/documents/edit.html:15 +msgid "Editing" +msgstr "Editando" + +#: templates/wagtaildocs/documents/list.html:21 +#: templates/wagtaildocs/documents/list.html:24 +msgid "Uploaded" +msgstr "Enviado" + +#: templates/wagtaildocs/documents/results.html:21 +#, python-format +msgid "" +"You haven't uploaded any documents. Why not <a href=" +"\"%(wagtaildocs_add_document_url)s\">upload one now</a>?" +msgstr "" +"Ainda não enviou nenhum documento. Porque não <a href=" +"\"%(wagtaildocs_add_document_url)s\">enviar um agora</a>?" + +#: templates/wagtaildocs/documents/usage.html:3 +#, python-format +msgid "Usage of %(title)s" +msgstr "Utilização de %(title)s" + +#: templates/wagtaildocs/documents/usage.html:5 +msgid "Usage of" +msgstr "Utilização de" + +#: templates/wagtaildocs/documents/usage.html:17 +msgid "Parent" +msgstr "Ascendente" + +#: templates/wagtaildocs/documents/usage.html:18 +msgid "Type" +msgstr "Tipo" + +#: templates/wagtaildocs/documents/usage.html:19 +msgid "Status" +msgstr "Estado" + +#: templates/wagtaildocs/documents/usage.html:26 +msgid "Edit this page" +msgstr "Editar esta ágina" + +#: templates/wagtaildocs/edit_handlers/document_chooser_panel.html:9 +msgid "Clear choice" +msgstr "Limpar escolha" + +#: templates/wagtaildocs/edit_handlers/document_chooser_panel.html:10 +msgid "Choose another document" +msgstr "Escolher outro documento" + +#: views/documents.py:37 views/documents.py:46 +msgid "Search documents" +msgstr "Procurar documentos" + +#: views/documents.py:86 +msgid "Document '{0}' added." +msgstr "Documento '{0}' adicionado." + +#: views/documents.py:89 views/documents.py:118 +msgid "The document could not be saved due to errors." +msgstr "O documento não pôde ser guardado devido a erros." + +#: views/documents.py:115 +msgid "Document '{0}' updated" +msgstr "Documento '{0}' atualizado" + +#: views/documents.py:137 +msgid "Document '{0}' deleted." +msgstr "Documento '{0}' apagado." diff --git a/wagtail/wagtaildocs/migrations/0001_initial.py b/wagtail/wagtaildocs/migrations/0001_initial.py new file mode 100644 index 000000000..dd8e4ac62 --- /dev/null +++ b/wagtail/wagtaildocs/migrations/0001_initial.py @@ -0,0 +1,32 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import taggit.managers +from django.conf import settings +import wagtail.wagtailadmin.taggable + + +class Migration(migrations.Migration): + + dependencies = [ + ('taggit', '__latest__'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Document', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('title', models.CharField(max_length=255, verbose_name='Title')), + ('file', models.FileField(upload_to='documents', verbose_name='File')), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('tags', taggit.managers.TaggableManager(to='taggit.Tag', verbose_name='Tags', help_text=None, blank=True, through='taggit.TaggedItem')), + ('uploaded_by_user', models.ForeignKey(editable=False, null=True, blank=True, to=settings.AUTH_USER_MODEL)), + ], + options={ + }, + bases=(models.Model, wagtail.wagtailadmin.taggable.TagSearchable), + ), + ] diff --git a/wagtail/wagtaildocs/migrations/0002_initial_data.py b/wagtail/wagtaildocs/migrations/0002_initial_data.py new file mode 100644 index 000000000..6ca3a0fbd --- /dev/null +++ b/wagtail/wagtaildocs/migrations/0002_initial_data.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +def add_document_permissions_to_admin_groups(apps, schema_editor): + ContentType = apps.get_model('contenttypes.ContentType') + Permission = apps.get_model('auth.Permission') + Group = apps.get_model('auth.Group') + Document = apps.get_model('wagtaildocs.Document') + + # Get document permissions + document_content_type, _created = ContentType.objects.get_or_create( + model='document', + app_label='wagtaildocs', + defaults={'name': 'document'} + ) + + add_document_permission, _created = Permission.objects.get_or_create( + content_type=document_content_type, + codename='add_document', + defaults={'name': 'Can add document'} + ) + change_document_permission, _created = Permission.objects.get_or_create( + content_type=document_content_type, + codename='change_document', + defaults={'name': 'Can change document'} + ) + delete_document_permission, _created = Permission.objects.get_or_create( + content_type=document_content_type, + codename='delete_document', + defaults={'name': 'Can delete document'} + ) + + # Assign it to Editors and Moderators groups + for group in Group.objects.filter(name__in=['Editors', 'Moderators']): + group.permissions.add(add_document_permission, change_document_permission, delete_document_permission) + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtaildocs', '0001_initial'), + + # Need to run wagtailcores initial data migration to make sure the groups are created + ('wagtailcore', '0002_initial_data'), + ] + + operations = [ + migrations.RunPython(add_document_permissions_to_admin_groups), + ] diff --git a/wagtail/wagtaildocs/migrations/__init__.py b/wagtail/wagtaildocs/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtail/wagtaildocs/models.py b/wagtail/wagtaildocs/models.py index f930a493c..5f9b374f2 100644 --- a/wagtail/wagtaildocs/models.py +++ b/wagtail/wagtaildocs/models.py @@ -13,7 +13,7 @@ from django.utils.encoding import python_2_unicode_compatible from wagtail.wagtailadmin.taggable import TagSearchable from wagtail.wagtailadmin.utils import get_object_usage -from wagtail.wagtailsearch import indexed +from wagtail.wagtailsearch import index @python_2_unicode_compatible @@ -26,7 +26,7 @@ class Document(models.Model, TagSearchable): tags = TaggableManager(help_text=None, blank=True, verbose_name=_('Tags')) search_fields = TagSearchable.search_fields + ( - indexed.FilterField('uploaded_by_user'), + index.FilterField('uploaded_by_user'), ) def __str__(self): diff --git a/wagtail/wagtailembeds/__init__.py b/wagtail/wagtailembeds/__init__.py index b75cbc491..54d955608 100644 --- a/wagtail/wagtailembeds/__init__.py +++ b/wagtail/wagtailembeds/__init__.py @@ -1,2 +1,4 @@ from .models import Embed from .embeds import get_embed + +default_app_config = 'wagtail.wagtailembeds.apps.WagtailEmbedsAppConfig' diff --git a/wagtail/wagtailembeds/apps.py b/wagtail/wagtailembeds/apps.py new file mode 100644 index 000000000..ecbaf6cb5 --- /dev/null +++ b/wagtail/wagtailembeds/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailEmbedsAppConfig(AppConfig): + name = 'wagtail.wagtailembeds' + label = 'wagtailembeds' + verbose_name = "Wagtail embeds" diff --git a/wagtail/wagtailembeds/locale/pt_PT/LC_MESSAGES/django.mo b/wagtail/wagtailembeds/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 000000000..0236ea963 Binary files /dev/null and b/wagtail/wagtailembeds/locale/pt_PT/LC_MESSAGES/django.mo differ diff --git a/wagtail/wagtailembeds/locale/pt_PT/LC_MESSAGES/django.po b/wagtail/wagtailembeds/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 000000000..9b6c937f6 --- /dev/null +++ b/wagtail/wagtailembeds/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,57 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +# Translators: +# Thiago Cangussu <cangussu.thg@gmail.com>, 2014 +msgid "" +msgstr "" +"Project-Id-Version: Wagtail 0.5.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-01 16:38+0100\n" +"PO-Revision-Date: 2014-08-03 01:53+0100\n" +"Last-Translator: Jose Lourenco <jose@lourenco.ws>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 1.5.4\n" +"Language: pt_PT\n" + +#: forms.py:11 +msgid "Please enter a valid URL" +msgstr "Por favor introduza uma URL válida" + +#: forms.py:15 +msgid "URL" +msgstr "URL" + +#: templates/wagtailembeds/chooser/chooser.html:3 +msgid "Insert embed" +msgstr "Inserir embed" + +#: templates/wagtailembeds/chooser/chooser.html:14 +msgid "Insert" +msgstr "Inserir" + +#: views/chooser.py:33 +msgid "" +"There seems to be a problem with your embedly API key. Please check your " +"settings." +msgstr "" +"Parece existir um problema com a sua chave API de embedly. Por favor " +"verifique as suas configurações." + +#: views/chooser.py:35 +msgid "Cannot find an embed for this URL." +msgstr "Não consigo encontrar um embed para esta URL." + +#: views/chooser.py:37 +msgid "" +"There seems to be an error with Embedly while trying to embed this URL. " +"Please try again later." +msgstr "" +"Parece que houve um erro em Embedly durante a tentativa de embed esta URL. " +"Por favor tente novamente." diff --git a/wagtail/wagtailembeds/migrations/0001_initial.py b/wagtail/wagtailembeds/migrations/0001_initial.py new file mode 100644 index 000000000..86b9e8d4b --- /dev/null +++ b/wagtail/wagtailembeds/migrations/0001_initial.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Embed', + fields=[ + ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True, serialize=False)), + ('url', models.URLField()), + ('max_width', models.SmallIntegerField(null=True, blank=True)), + ('type', models.CharField(max_length=10, choices=[('video', 'Video'), ('photo', 'Photo'), ('link', 'Link'), ('rich', 'Rich')])), + ('html', models.TextField(blank=True)), + ('title', models.TextField(blank=True)), + ('author_name', models.TextField(blank=True)), + ('provider_name', models.TextField(blank=True)), + ('thumbnail_url', models.URLField(null=True, blank=True)), + ('width', models.IntegerField(null=True, blank=True)), + ('height', models.IntegerField(null=True, blank=True)), + ('last_updated', models.DateTimeField(auto_now=True)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.AlterUniqueTogether( + name='embed', + unique_together=set([('url', 'max_width')]), + ), + ] diff --git a/wagtail/wagtailembeds/migrations/__init__.py b/wagtail/wagtailembeds/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtail/wagtailembeds/templatetags/embed_filters.py b/wagtail/wagtailembeds/templatetags/embed_filters.py deleted file mode 100644 index 1eef037e8..000000000 --- a/wagtail/wagtailembeds/templatetags/embed_filters.py +++ /dev/null @@ -1,11 +0,0 @@ -import warnings - -from wagtail.utils.deprecation import RemovedInWagtail06Warning - - -warnings.warn( - "The embed_filters tag library has been moved to wagtailembeds_tags. " - "Use {% load wagtailembeds_tags %} instead.", RemovedInWagtail06Warning) - - -from wagtail.wagtailembeds.templatetags.wagtailembeds_tags import register, embed diff --git a/wagtail/wagtailforms/__init__.py b/wagtail/wagtailforms/__init__.py index e69de29bb..7be37b5f1 100644 --- a/wagtail/wagtailforms/__init__.py +++ b/wagtail/wagtailforms/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.wagtailforms.apps.WagtailFormsAppConfig' diff --git a/wagtail/wagtailforms/apps.py b/wagtail/wagtailforms/apps.py new file mode 100644 index 000000000..7336f20e0 --- /dev/null +++ b/wagtail/wagtailforms/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailFormsAppConfig(AppConfig): + name = 'wagtail.wagtailforms' + label = 'wagtailforms' + verbose_name = "Wagtail forms" diff --git a/wagtail/wagtailforms/migrations/0001_initial.py b/wagtail/wagtailforms/migrations/0001_initial.py new file mode 100644 index 000000000..4b28f0ddf --- /dev/null +++ b/wagtail/wagtailforms/migrations/0001_initial.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0002_initial_data'), + ] + + operations = [ + migrations.CreateModel( + name='FormSubmission', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', primary_key=True, auto_created=True)), + ('form_data', models.TextField()), + ('submit_time', models.DateTimeField(auto_now_add=True)), + ('page', models.ForeignKey(to='wagtailcore.Page')), + ], + options={ + }, + bases=(models.Model,), + ), + ] diff --git a/wagtail/wagtailforms/migrations/__init__.py b/wagtail/wagtailforms/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtail/wagtailimages/__init__.py b/wagtail/wagtailimages/__init__.py index e69de29bb..61397a911 100644 --- a/wagtail/wagtailimages/__init__.py +++ b/wagtail/wagtailimages/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.wagtailimages.apps.WagtailImagesAppConfig' diff --git a/wagtail/wagtailimages/apps.py b/wagtail/wagtailimages/apps.py new file mode 100644 index 000000000..88cd6e3f0 --- /dev/null +++ b/wagtail/wagtailimages/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailImagesAppConfig(AppConfig): + name = 'wagtail.wagtailimages' + label = 'wagtailimages' + verbose_name = "Wagtail images" diff --git a/wagtail/wagtailimages/formats.py b/wagtail/wagtailimages/formats.py index d00b65b44..3c5644a07 100644 --- a/wagtail/wagtailimages/formats.py +++ b/wagtail/wagtailimages/formats.py @@ -1,11 +1,6 @@ -from django.conf import settings from django.utils.html import escape -try: - from importlib import import_module -except ImportError: - # for Python 2.6, fall back on django.utils.importlib (deprecated as of Django 1.7) - from django.utils.importlib import import_module +from wagtail.utils.apps import get_app_submodules class Format(object): @@ -85,12 +80,7 @@ _searched_for_image_formats = False def search_for_image_formats(): global _searched_for_image_formats if not _searched_for_image_formats: - for app_module in settings.INSTALLED_APPS: - try: - import_module('%s.image_formats' % app_module) - except ImportError: - continue - + list(get_app_submodules('image_formats')) _searched_for_image_formats = True diff --git a/wagtail/wagtailimages/locale/pt_PT/LC_MESSAGES/django.mo b/wagtail/wagtailimages/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 000000000..dfde945b6 Binary files /dev/null and b/wagtail/wagtailimages/locale/pt_PT/LC_MESSAGES/django.mo differ diff --git a/wagtail/wagtailimages/locale/pt_PT/LC_MESSAGES/django.po b/wagtail/wagtailimages/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 000000000..13f4e9c99 --- /dev/null +++ b/wagtail/wagtailimages/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,314 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +# Translators: +# Thiago Cangussu <cangussu.thg@gmail.com>, 2014 +msgid "" +msgstr "" +"Project-Id-Version: Wagtail 0.5.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-01 16:39+0100\n" +"PO-Revision-Date: 2014-08-03 01:55+0100\n" +"Last-Translator: Jose Lourenco <jose@lourenco.ws>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 1.5.4\n" +"Language: pt_PT\n" + +#: forms.py:37 +msgid "Filter" +msgstr "Filtro" + +#: forms.py:39 +msgid "Original size" +msgstr "Dimensão original" + +#: forms.py:40 +msgid "Resize to width" +msgstr "Redimensionar pela largura" + +#: forms.py:41 +msgid "Resize to height" +msgstr "Redimensionar pela altura" + +#: forms.py:42 +msgid "Resize to min" +msgstr "Redimensionar pelo min" + +#: forms.py:43 +msgid "Resize to max" +msgstr "Redimensionar pelo máx" + +#: forms.py:44 +msgid "Resize to fill" +msgstr "Redimensionar para preencher" + +#: forms.py:47 +msgid "Width" +msgstr "Largura" + +#: forms.py:48 +msgid "Height" +msgstr "Altura" + +#: models.py:34 templates/wagtailimages/images/usage.html:16 +msgid "Title" +msgstr "Título" + +#: models.py:49 +msgid "File" +msgstr "Ficheiro" + +#: models.py:55 +msgid "Tags" +msgstr "Etiquetas" + +#: wagtail_hooks.py:64 templates/wagtailimages/images/index.html:5 +#: templates/wagtailimages/images/index.html:18 +msgid "Images" +msgstr "Imagens" + +#: templates/wagtailimages/chooser/chooser.html:3 +#: templates/wagtailimages/edit_handlers/image_chooser_panel.html:19 +msgid "Choose an image" +msgstr "Escolher uma imagem" + +#: templates/wagtailimages/chooser/chooser.html:8 +#: templates/wagtailimages/chooser/chooser.html:20 +msgid "Search" +msgstr "Procurar" + +#: templates/wagtailimages/chooser/chooser.html:9 +#: templates/wagtailimages/chooser/chooser.html:43 +msgid "Upload" +msgstr "Enviar" + +#: templates/wagtailimages/chooser/chooser.html:23 +msgid "Popular tags" +msgstr "Etiquetas frequentes" + +#: templates/wagtailimages/chooser/results.html:6 +#: templates/wagtailimages/images/results.html:6 +#, python-format +msgid "" +"\n" +" There is one match\n" +" " +msgid_plural "" +"\n" +" There are %(counter)s matches\n" +" " +msgstr[0] "" +"\n" +" Existe uma correspondência\n" +" " +msgstr[1] "" +"\n" +" Existem %(counter)s correspondências\n" +" " + +#: templates/wagtailimages/chooser/results.html:13 +#: templates/wagtailimages/images/results.html:13 +msgid "Latest images" +msgstr "Últimas imagens" + +#: templates/wagtailimages/chooser/select_format.html:3 +msgid "Choose a format" +msgstr "Escolher um formato" + +#: templates/wagtailimages/chooser/select_format.html:17 +msgid "Insert image" +msgstr "Inserir imagem" + +#: templates/wagtailimages/edit_handlers/image_chooser_panel.html:17 +msgid "Clear image" +msgstr "Limpar imagem" + +#: templates/wagtailimages/edit_handlers/image_chooser_panel.html:18 +msgid "Choose another image" +msgstr "Escolher outra imagem" + +#: templates/wagtailimages/images/_file_field.html:6 +msgid "Change image:" +msgstr "Alterar imagem:" + +#: templates/wagtailimages/images/add.html:4 +#: templates/wagtailimages/images/index.html:19 +msgid "Add an image" +msgstr "Adicionar uma imagem" + +#: templates/wagtailimages/images/add.html:15 +msgid "Add image" +msgstr "Adicionar imagem" + +#: templates/wagtailimages/images/add.html:25 +#: templates/wagtailimages/images/edit.html:33 +msgid "Save" +msgstr "Guardar" + +#: templates/wagtailimages/images/confirm_delete.html:4 +#: templates/wagtailimages/images/confirm_delete.html:8 +#: templates/wagtailimages/images/edit.html:33 +msgid "Delete image" +msgstr "Eliminar imagem" + +#: templates/wagtailimages/images/confirm_delete.html:16 +msgid "Are you sure you want to delete this image?" +msgstr "Tem a certeza que quer eliminar esta imagem?" + +#: templates/wagtailimages/images/confirm_delete.html:19 +msgid "Yes, delete" +msgstr "Sim, eliminar" + +#: templates/wagtailimages/images/edit.html:4 +#: templates/wagtailimages/images/url_generator.html:4 +#, python-format +msgid "Editing image %(title)s" +msgstr "Editando imagem %(title)s" + +#: templates/wagtailimages/images/edit.html:15 +msgid "Editing" +msgstr "Editando" + +#: templates/wagtailimages/images/results.html:31 +#, python-format +msgid "Sorry, no images match \"<em>%(query_string)s</em>\"" +msgstr "Desculpe, nenhuma imagem corresponde a \"<em>%(query_string)s</em>\"" + +#: templates/wagtailimages/images/results.html:34 +#, python-format +msgid "" +"You've not uploaded any images. Why not <a href=" +"\"%(wagtailimages_add_image_url)s\">add one now</a>?" +msgstr "" +"Ainda não enviou qualquer imagem. Porque não <a href=" +"\"%(wagtailimages_add_image_url)s\">adicionar uma agora</a>?" + +#: templates/wagtailimages/images/url_generator.html:9 +msgid "Generating URL" +msgstr "A gerar URL" + +#: templates/wagtailimages/images/url_generator.html:25 +msgid "URL" +msgstr "URL" + +#: templates/wagtailimages/images/url_generator.html:28 +msgid "Preview" +msgstr "Pre-visualizar" + +#: templates/wagtailimages/images/url_generator.html:34 +msgid "" +"Note that images generated larger than the screen will appear smaller when " +"previewed here, so they fit the screen." +msgstr "" +"Note que as imagens criadas com dimensões superiores às do ecrã serão pre-" +"visualizadas mais pequenas para caberem no ecrã." + +#: templates/wagtailimages/images/usage.html:3 +#, python-format +msgid "Usage of %(title)s" +msgstr "Utilização de %(title)s" + +#: templates/wagtailimages/images/usage.html:5 +msgid "Usage of" +msgstr "Utilização de" + +#: templates/wagtailimages/images/usage.html:17 +msgid "Parent" +msgstr "Ascendente" + +#: templates/wagtailimages/images/usage.html:18 +msgid "Type" +msgstr "Tipo" + +#: templates/wagtailimages/images/usage.html:19 +msgid "Status" +msgstr "Estado" + +#: templates/wagtailimages/images/usage.html:26 +msgid "Edit this page" +msgstr "Editar esta página" + +#: templates/wagtailimages/multiple/add.html:3 +msgid "Add multiple images" +msgstr "Adicionar múltiplas imagens" + +#: templates/wagtailimages/multiple/add.html:13 +msgid "Add images" +msgstr "Adicionar imagens" + +#: templates/wagtailimages/multiple/add.html:18 +msgid "Drag and drop images into this area to upload immediately." +msgstr "Arrastar e largar imagens nesta área para envio imediato." + +#: templates/wagtailimages/multiple/add.html:22 +msgid "Or choose from your computer" +msgstr "Ou escolha no seu computador" + +#: templates/wagtailimages/multiple/add.html:47 +msgid "" +"Upload successful. Please update this image with a more appropriate title, " +"if necessary. You may also delete the image completely if the upload wasn't " +"required." +msgstr "" +"Envio com sucesso. Por favor atualize esta imagem com um título mais " +"apropriado se necessário. Também pode eliminar completamente a imagem se o " +"envio não era pretendido." + +#: templates/wagtailimages/multiple/add.html:48 +msgid "Sorry, upload failed." +msgstr "Desculpe, o envio falhou." + +#: templates/wagtailimages/multiple/edit_form.html:10 +msgid "Update" +msgstr "Atualizar" + +#: templates/wagtailimages/multiple/edit_form.html:11 +msgid "Delete" +msgstr "Eliminar" + +#: utils/validators.py:17 utils/validators.py:28 +msgid "" +"Not a valid image. Please use a gif, jpeg or png file with the correct file " +"extension (*.gif, *.jpg or *.png)." +msgstr "" +"Não é uma imagem válida. Por favor use uma imagem do tipo gif, jpeg, ou " +"png, com a extensão de nome correta (*.gif, *.jpg or *.png)." + +#: utils/validators.py:35 +#, python-format +msgid "" +"Not a valid %s image. Please use a gif, jpeg or png file with the correct " +"file extension (*.gif, *.jpg or *.png)." +msgstr "" +"Não é uma imagem do tipo %s válida. Por favor use uma imagem do tipo gif, " +"jpeg, ou png, com a extensão de nome correta (*.gif, *.jpg or *.png)." + +#: views/images.py:37 views/images.py:47 +msgid "Search images" +msgstr "Procurar imagens" + +#: views/images.py:99 +msgid "Image '{0}' updated." +msgstr "Imagem '{0}' atualizada." + +#: views/images.py:102 +msgid "The image could not be saved due to errors." +msgstr "A imagem não pôde ser guardada devido a erros." + +#: views/images.py:188 +msgid "Image '{0}' deleted." +msgstr "Imagem '{0}' eliminada." + +#: views/images.py:206 +msgid "Image '{0}' added." +msgstr "Imagem '{0}' adicionada." + +#: views/images.py:209 +msgid "The image could not be created due to errors." +msgstr "A imagem não pôde ser criada devido a erros." diff --git a/wagtail/wagtailimages/migrations/0001_initial.py b/wagtail/wagtailimages/migrations/0001_initial.py new file mode 100644 index 000000000..64bb96257 --- /dev/null +++ b/wagtail/wagtailimages/migrations/0001_initial.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import wagtail.wagtailimages.utils.validators +import wagtail.wagtailimages.models +import taggit.managers +from django.conf import settings +import wagtail.wagtailadmin.taggable + + +class Migration(migrations.Migration): + + dependencies = [ + ('taggit', '__latest__'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Filter', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')), + ('spec', models.CharField(db_index=True, max_length=255)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Image', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')), + ('title', models.CharField(verbose_name='Title', max_length=255)), + ('file', models.ImageField(width_field='width', upload_to=wagtail.wagtailimages.models.get_upload_to, verbose_name='File', height_field='height', validators=[wagtail.wagtailimages.utils.validators.validate_image_format])), + ('width', models.IntegerField(editable=False)), + ('height', models.IntegerField(editable=False)), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('focal_point_x', models.PositiveIntegerField(editable=False, null=True)), + ('focal_point_y', models.PositiveIntegerField(editable=False, null=True)), + ('focal_point_width', models.PositiveIntegerField(editable=False, null=True)), + ('focal_point_height', models.PositiveIntegerField(editable=False, null=True)), + ('tags', taggit.managers.TaggableManager(verbose_name='Tags', blank=True, help_text=None, to='taggit.Tag', through='taggit.TaggedItem')), + ('uploaded_by_user', models.ForeignKey(editable=False, blank=True, null=True, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'abstract': False, + }, + bases=(models.Model, wagtail.wagtailadmin.taggable.TagSearchable), + ), + migrations.CreateModel( + name='Rendition', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False, auto_created=True, verbose_name='ID')), + ('file', models.ImageField(width_field='width', upload_to='images', height_field='height')), + ('width', models.IntegerField(editable=False)), + ('height', models.IntegerField(editable=False)), + ('focal_point_key', models.CharField(editable=False, max_length=255, null=True)), + ('filter', models.ForeignKey(related_name='+', to='wagtailimages.Filter')), + ('image', models.ForeignKey(related_name='renditions', to='wagtailimages.Image')), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.AlterUniqueTogether( + name='rendition', + unique_together=set([('image', 'filter', 'focal_point_key')]), + ), + ] diff --git a/wagtail/wagtailimages/migrations/0002_initial_data.py b/wagtail/wagtailimages/migrations/0002_initial_data.py new file mode 100644 index 000000000..7451ba7d7 --- /dev/null +++ b/wagtail/wagtailimages/migrations/0002_initial_data.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +def add_image_permissions_to_admin_groups(apps, schema_editor): + ContentType = apps.get_model('contenttypes.ContentType') + Permission = apps.get_model('auth.Permission') + Group = apps.get_model('auth.Group') + Image = apps.get_model('wagtailimages.Image') + + # Get image permissions + image_content_type, _created = ContentType.objects.get_or_create( + model='image', + app_label='wagtailimages', + defaults={'name': 'image'} + ) + + add_image_permission, _created = Permission.objects.get_or_create( + content_type=image_content_type, + codename='add_image', + defaults={'name': 'Can add image'} + ) + change_image_permission, _created = Permission.objects.get_or_create( + content_type=image_content_type, + codename='change_image', + defaults={'name': 'Can change image'} + ) + delete_image_permission, _created = Permission.objects.get_or_create( + content_type=image_content_type, + codename='delete_image', + defaults={'name': 'Can delete image'} + ) + + # Assign it to Editors and Moderators groups + for group in Group.objects.filter(name__in=['Editors', 'Moderators']): + group.permissions.add(add_image_permission, change_image_permission, delete_image_permission) + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailimages', '0001_initial'), + + # Need to run wagtailcores initial data migration to make sure the groups are created + ('wagtailcore', '0002_initial_data'), + ] + + operations = [ + migrations.RunPython(add_image_permissions_to_admin_groups), + ] diff --git a/wagtail/wagtailimages/migrations/__init__.py b/wagtail/wagtailimages/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtail/wagtailimages/models.py b/wagtail/wagtailimages/models.py index b29d50e0c..04ae37ad0 100644 --- a/wagtail/wagtailimages/models.py +++ b/wagtail/wagtailimages/models.py @@ -22,30 +22,30 @@ from unidecode import unidecode from wagtail.wagtailadmin.taggable import TagSearchable from wagtail.wagtailimages.backends import get_image_backend -from wagtail.wagtailsearch import indexed +from wagtail.wagtailsearch import index from wagtail.wagtailimages.utils.validators import validate_image_format from wagtail.wagtailimages.utils.focal_point import FocalPoint from wagtail.wagtailimages.utils.feature_detection import FeatureDetector, opencv_available from wagtail.wagtailadmin.utils import get_object_usage +def get_upload_to(instance, filename): + folder_name = 'original_images' + filename = instance.file.field.storage.get_valid_name(filename) + + # do a unidecode in the filename and then + # replace non-ascii characters in filename with _ , to sidestep issues with filesystem encoding + filename = "".join((i if ord(i) < 128 else '_') for i in unidecode(filename)) + + while len(os.path.join(folder_name, filename)) >= 95: + prefix, dot, extension = filename.rpartition('.') + filename = prefix[:-1] + dot + extension + return os.path.join(folder_name, filename) + + @python_2_unicode_compatible class AbstractImage(models.Model, TagSearchable): title = models.CharField(max_length=255, verbose_name=_('Title') ) - - def get_upload_to(self, filename): - folder_name = 'original_images' - filename = self.file.field.storage.get_valid_name(filename) - - # do a unidecode in the filename and then - # replace non-ascii characters in filename with _ , to sidestep issues with filesystem encoding - filename = "".join((i if ord(i) < 128 else '_') for i in unidecode(filename)) - - while len(os.path.join(folder_name, filename)) >= 95: - prefix, dot, extension = filename.rpartition('.') - filename = prefix[:-1] + dot + extension - return os.path.join(folder_name, filename) - file = models.ImageField(verbose_name=_('File'), upload_to=get_upload_to, width_field='width', height_field='height', validators=[validate_image_format]) width = models.IntegerField(editable=False) height = models.IntegerField(editable=False) @@ -68,7 +68,7 @@ class AbstractImage(models.Model, TagSearchable): args=(self.id,)) search_fields = TagSearchable.search_fields + ( - indexed.FilterField('uploaded_by_user'), + index.FilterField('uploaded_by_user'), ) def __str__(self): diff --git a/wagtail/wagtailimages/templatetags/image_tags.py b/wagtail/wagtailimages/templatetags/image_tags.py deleted file mode 100644 index 00e59aca0..000000000 --- a/wagtail/wagtailimages/templatetags/image_tags.py +++ /dev/null @@ -1,11 +0,0 @@ -import warnings - -from wagtail.utils.deprecation import RemovedInWagtail06Warning - - -warnings.warn( - "The image_tags tag library has been moved to wagtailimages_tags. " - "Use {% load wagtailimages_tags %} instead.", RemovedInWagtail06Warning) - - -from wagtail.wagtailimages.templatetags.wagtailimages_tags import register, image diff --git a/wagtail/wagtailredirects/__init__.py b/wagtail/wagtailredirects/__init__.py index e69de29bb..b192b1b24 100644 --- a/wagtail/wagtailredirects/__init__.py +++ b/wagtail/wagtailredirects/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.wagtailredirects.apps.WagtailRedirectsAppConfig' diff --git a/wagtail/wagtailredirects/apps.py b/wagtail/wagtailredirects/apps.py new file mode 100644 index 000000000..400299f02 --- /dev/null +++ b/wagtail/wagtailredirects/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailRedirectsAppConfig(AppConfig): + name = 'wagtail.wagtailredirects' + label = 'wagtailredirects' + verbose_name = "Wagtail redirects" diff --git a/wagtail/wagtailredirects/locale/pt_PT/LC_MESSAGES/django.mo b/wagtail/wagtailredirects/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 000000000..e6fb7e2b6 Binary files /dev/null and b/wagtail/wagtailredirects/locale/pt_PT/LC_MESSAGES/django.mo differ diff --git a/wagtail/wagtailredirects/locale/pt_PT/LC_MESSAGES/django.po b/wagtail/wagtailredirects/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 000000000..759a4906a --- /dev/null +++ b/wagtail/wagtailredirects/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,169 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +# Translators: +# Thiago Cangussu <cangussu.thg@gmail.com>, 2014 +msgid "" +msgstr "" +"Project-Id-Version: Wagtail 0.5.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-01 16:39+0100\n" +"PO-Revision-Date: 2014-08-03 01:56+0100\n" +"Last-Translator: Jose Lourenco <jose@lourenco.ws>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 1.5.4\n" +"Language: pt_PT\n" + +#: models.py:10 +msgid "Redirect from" +msgstr "Redirecionar de" + +#: models.py:12 +msgid "Permanent" +msgstr "Permanente" + +#: models.py:12 +msgid "" +"Recommended. Permanent redirects ensure search engines forget the old page " +"(the 'Redirect from') and index the new page instead." +msgstr "" +"Recomendado. Redirecionamentos permanentes garantem que os motores de busca " +"esqueçam a página antiga (o 'Redirecionar de') e indexem a nova página." + +#: models.py:13 +msgid "Redirect to a page" +msgstr "Redirecionar para uma página" + +#: models.py:14 +msgid "Redirect to any URL" +msgstr "Redirecionar para qualquer URL" + +#: views.py:58 +msgid "Search redirects" +msgstr "Procurar redireções" + +#: views.py:71 +msgid "Redirect '{0}' updated." +msgstr "Redireção '{0}' atualizada." + +#: views.py:74 +msgid "The redirect could not be saved due to errors." +msgstr "A redireção não pôde ser guardada devido a erros." + +#: views.py:92 +msgid "Redirect '{0}' deleted." +msgstr "Redireção '{0}' eliminada." + +#: views.py:112 +msgid "Redirect '{0}' added." +msgstr "Redireção '{0}' adicionada." + +#: views.py:115 +msgid "The redirect could not be created due to errors." +msgstr "A redireção não pôde ser criada devido a erros." + +#: wagtail_hooks.py:22 templates/wagtailredirects/index.html:3 +#: templates/wagtailredirects/index.html:17 +msgid "Redirects" +msgstr "Redireções" + +#: templates/wagtailredirects/add.html:3 templates/wagtailredirects/add.html:6 +#: templates/wagtailredirects/index.html:18 +msgid "Add redirect" +msgstr "Adicionar redireção" + +#: templates/wagtailredirects/add.html:14 +#: templates/wagtailredirects/edit.html:14 +msgid "Save" +msgstr "Guardar" + +#: templates/wagtailredirects/confirm_delete.html:4 +#, python-format +msgid "Delete redirect %(title)s" +msgstr "Eliminar redireção %(title)s" + +#: templates/wagtailredirects/confirm_delete.html:6 +msgid "Delete" +msgstr "Eliminar" + +#: templates/wagtailredirects/confirm_delete.html:10 +msgid "Are you sure you want to delete this redirect?" +msgstr "Tem a certeza que pretende eliminar esta redireção?" + +#: templates/wagtailredirects/confirm_delete.html:13 +msgid "Yes, delete" +msgstr "Sim, eliminar" + +#: templates/wagtailredirects/edit.html:4 +#, python-format +msgid "Editing %(title)s" +msgstr "Editando %(title)s" + +#: templates/wagtailredirects/edit.html:6 +msgid "Editing" +msgstr "Editando" + +#: templates/wagtailredirects/edit.html:15 +msgid "Delete redirect" +msgstr "Eliminar redireção" + +#: templates/wagtailredirects/list.html:11 +#: templates/wagtailredirects/list.html:14 +msgid "From" +msgstr "De" + +#: templates/wagtailredirects/list.html:17 +msgid "To" +msgstr "Para" + +#: templates/wagtailredirects/list.html:18 +msgid "Type" +msgstr "Tipo" + +#: templates/wagtailredirects/list.html:25 +msgid "Edit this redirect" +msgstr "Editar esta redireção" + +#: templates/wagtailredirects/list.html:34 +msgid "primary" +msgstr "principal" + +#: templates/wagtailredirects/results.html:5 +#, python-format +msgid "" +"\n" +" There is one match\n" +" " +msgid_plural "" +"\n" +" There are %(counter)s matches\n" +" " +msgstr[0] "" +"\n" +" Existe uma correspondência\n" +" " +msgstr[1] "" +"\n" +" Existem %(counter)s correspondências\n" +" " + +#: templates/wagtailredirects/results.html:18 +#, python-format +msgid "Sorry, no redirects match \"<em>%(query_string)s</em>\"" +msgstr "" +"Desculpe, nenhuma redireção corresponde a \"<em>%(query_string)s</em>\"" + +#: templates/wagtailredirects/results.html:21 +#, python-format +msgid "" +"No redirects have been created. Why not <a href=" +"\"%(wagtailredirects_add_redirect_url)s\">add one</a>?" +msgstr "" +"Nenhuma redireção foi criada. Porque não <a href=" +"\"%(wagtailredirects_add_redirect_url)s\">adicionar uma</a>?" diff --git a/wagtail/wagtailredirects/migrations/0001_initial.py b/wagtail/wagtailredirects/migrations/0001_initial.py new file mode 100644 index 000000000..98289544d --- /dev/null +++ b/wagtail/wagtailredirects/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0002_initial_data'), + ] + + operations = [ + migrations.CreateModel( + name='Redirect', + fields=[ + ('id', models.AutoField(verbose_name='ID', auto_created=True, serialize=False, primary_key=True)), + ('old_path', models.CharField(verbose_name='Redirect from', max_length=255, unique=True, db_index=True)), + ('is_permanent', models.BooleanField(verbose_name='Permanent', default=True, help_text="Recommended. Permanent redirects ensure search engines forget the old page (the 'Redirect from') and index the new page instead.")), + ('redirect_link', models.URLField(blank=True, verbose_name='Redirect to any URL')), + ('redirect_page', models.ForeignKey(blank=True, null=True, verbose_name='Redirect to a page', to='wagtailcore.Page')), + ('site', models.ForeignKey(blank=True, to='wagtailcore.Site', editable=False, null=True, related_name='redirects')), + ], + options={ + }, + bases=(models.Model,), + ), + ] diff --git a/wagtail/wagtailredirects/migrations/__init__.py b/wagtail/wagtailredirects/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtail/wagtailsearch/__init__.py b/wagtail/wagtailsearch/__init__.py index ed896f445..0e24694be 100644 --- a/wagtail/wagtailsearch/__init__.py +++ b/wagtail/wagtailsearch/__init__.py @@ -1,3 +1,5 @@ -from wagtail.wagtailsearch.indexed import Indexed +from wagtail.wagtailsearch.index import Indexed from wagtail.wagtailsearch.signal_handlers import register_signal_handlers -from wagtail.wagtailsearch.backends import get_search_backend \ No newline at end of file +from wagtail.wagtailsearch.backends import get_search_backend + +default_app_config = 'wagtail.wagtailsearch.apps.WagtailSearchAppConfig' diff --git a/wagtail/wagtailsearch/apps.py b/wagtail/wagtailsearch/apps.py new file mode 100644 index 000000000..e3b07c721 --- /dev/null +++ b/wagtail/wagtailsearch/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailSearchAppConfig(AppConfig): + name = 'wagtail.wagtailsearch' + label = 'wagtailsearch' + verbose_name = "Wagtail search" diff --git a/wagtail/wagtailsearch/backends/base.py b/wagtail/wagtailsearch/backends/base.py index 82e2e8d56..1928a7bbe 100644 --- a/wagtail/wagtailsearch/backends/base.py +++ b/wagtail/wagtailsearch/backends/base.py @@ -2,7 +2,7 @@ from django.db import models from django.db.models.query import QuerySet from django.core.exceptions import ImproperlyConfigured -from wagtail.wagtailsearch.indexed import Indexed +from wagtail.wagtailsearch.index import Indexed from wagtail.wagtailsearch.utils import normalise_query_string diff --git a/wagtail/wagtailsearch/backends/db.py b/wagtail/wagtailsearch/backends/db.py index a94fe3c58..3f7e64f42 100644 --- a/wagtail/wagtailsearch/backends/db.py +++ b/wagtail/wagtailsearch/backends/db.py @@ -1,7 +1,6 @@ from django.db import models from wagtail.wagtailsearch.backends.base import BaseSearch -from wagtail.wagtailsearch.indexed import Indexed class DBSearch(BaseSearch): diff --git a/wagtail/wagtailsearch/backends/elasticsearch.py b/wagtail/wagtailsearch/backends/elasticsearch.py index 8f8a78dbb..341cc342e 100644 --- a/wagtail/wagtailsearch/backends/elasticsearch.py +++ b/wagtail/wagtailsearch/backends/elasticsearch.py @@ -5,13 +5,19 @@ import json from six.moves.urllib.parse import urlparse from django.db import models -from django.db.models.sql.where import SubqueryConstraint +from django.db.models.sql.where import SubqueryConstraint, WhereNode + +# Django 1.7 lookups +try: + from django.db.models.lookups import Lookup +except ImportError: + Lookup = None from elasticsearch import Elasticsearch, NotFoundError, RequestError from elasticsearch.helpers import bulk from wagtail.wagtailsearch.backends.base import BaseSearch -from wagtail.wagtailsearch.indexed import Indexed, SearchField, FilterField +from wagtail.wagtailsearch.index import Indexed, SearchField, FilterField class ElasticSearchMapping(object): @@ -125,118 +131,133 @@ class ElasticSearchQuery(object): self.query_string = query_string self.fields = fields + def _process_lookup(self, field_attname, lookup, value): + # Get field + field = dict( + (field.get_attname(self.queryset.model), field) + for field in self.queryset.model.get_filterable_search_fields() + ).get(field_attname, None) + + # Give error if the field doesn't exist + if field is None: + raise FieldError('Cannot filter ElasticSearch results with field "' + field_name + '". Please add FilterField(\'' + field_name + '\') to ' + self.queryset.model.__name__ + '.search_fields.') + + # Get the name of the field in the index + field_index_name = field.get_index_name(self.queryset.model) + + if lookup == 'exact': + if value is None: + return { + 'missing': { + 'field': field_index_name, + } + } + else: + return { + 'term': { + field_index_name: value, + } + } + + if lookup == 'isnull': + if value: + return { + 'missing': { + 'field': field_index_name, + } + } + else: + return { + 'not': { + 'missing': { + 'field': field_index_name, + } + } + } + + if lookup in ['startswith', 'prefix']: + return { + 'prefix': { + field_index_name: value, + } + } + + if lookup in ['gt', 'gte', 'lt', 'lte']: + return { + 'range': { + field_index_name: { + lookup: value, + } + } + } + + if lookup == 'range': + lower, upper = value + + return { + 'range': { + field_index_name: { + 'gte': lower, + 'lte': upper, + } + } + } + + if lookup == 'in': + return { + 'terms': { + field_index_name: value, + } + } + + raise FilterError('Could not apply filter on ElasticSearch results: "' + field_name + '__' + lookup + ' = ' + unicode(value) + '". Lookup "' + lookup + '"" not recognosed.') + def _get_filters_from_where(self, where_node): # Check if this is a leaf node - if isinstance(where_node, tuple): - field_name = where_node[0].col + if isinstance(where_node, tuple): # Django 1.6 and below + field_attname = where_node[0].col lookup = where_node[1] value = where_node[3] - # Get field - field = dict( - (field.get_attname(self.queryset.model), field) - for field in self.queryset.model.get_filterable_search_fields() - ).get(field_name, None) + # Process the filter + return self._process_lookup(field_attname, lookup, value) - # Give error if the field doesn't exist - if field is None: - raise FieldError('Cannot filter ElasticSearch results with field "' + field_name + '". Please add FilterField(\'' + field_name + '\') to ' + self.queryset.model.__name__ + '.search_fields.') + elif Lookup is not None and isinstance(where_node, Lookup): # Django 1.7 and above + field_attname = where_node.lhs.target.attname + lookup = where_node.lookup_name + value = where_node.rhs - # Get the name of the field in the index - field_index_name = field.get_index_name(self.queryset.model) + # Process the filter + return self._process_lookup(field_attname, lookup, value) - # Find lookup - if lookup == 'exact': - if value is None: - return { - 'missing': { - 'field': field_index_name, - } - } - else: - return { - 'term': { - field_index_name: value, - } - } - - if lookup == 'isnull': - if value: - return { - 'missing': { - 'field': field_index_name, - } - } - else: - return { - 'not': { - 'missing': { - 'field': field_index_name, - } - } - } - - if lookup in ['startswith', 'prefix']: - return { - 'prefix': { - field_index_name: value, - } - } - - if lookup in ['gt', 'gte', 'lt', 'lte']: - return { - 'range': { - field_index_name: { - lookup: value, - } - } - } - - if lookup == 'range': - lower, upper = value - - return { - 'range': { - field_index_name: { - 'gte': lower, - 'lte': upper, - } - } - } - - if lookup == 'in': - return { - 'terms': { - field_index_name: value, - } - } - - raise FilterError('Could not apply filter on ElasticSearch results: "' + field_name + '__' + lookup + ' = ' + unicode(value) + '". Lookup "' + lookup + '"" not recognosed.') elif isinstance(where_node, SubqueryConstraint): raise FilterError('Could not apply filter on ElasticSearch results: Subqueries are not allowed.') - # Get child filters - connector = where_node.connector - child_filters = [self._get_filters_from_where(child) for child in where_node.children] - child_filters = [child_filter for child_filter in child_filters if child_filter] + elif isinstance(where_node, WhereNode): + # Get child filters + connector = where_node.connector + child_filters = [self._get_filters_from_where(child) for child in where_node.children] + child_filters = [child_filter for child_filter in child_filters if child_filter] - # Connect them - if child_filters: - if len(child_filters) == 1: - filter_out = child_filters[0] - else: - filter_out = { - connector.lower(): [ - fil for fil in child_filters if fil is not None - ] - } + # Connect them + if child_filters: + if len(child_filters) == 1: + filter_out = child_filters[0] + else: + filter_out = { + connector.lower(): [ + fil for fil in child_filters if fil is not None + ] + } - if where_node.negated: - filter_out = { - 'not': filter_out - } + if where_node.negated: + filter_out = { + 'not': filter_out + } - return filter_out + return filter_out + else: + raise FilterError('Could not apply filter on ElasticSearch results: Unknown where node: ' + str(type(where_node))) def _get_filters(self): # Filters diff --git a/wagtail/wagtailsearch/index.py b/wagtail/wagtailsearch/index.py new file mode 100644 index 000000000..82790c580 --- /dev/null +++ b/wagtail/wagtailsearch/index.py @@ -0,0 +1,110 @@ +import warnings + +from six import string_types + +from django.db import models + + +class Indexed(object): + @classmethod + def indexed_get_parent(cls, require_model=True): + for base in cls.__bases__: + if issubclass(base, Indexed) and (issubclass(base, models.Model) or require_model is False): + return base + + @classmethod + def indexed_get_content_type(cls): + # Work out content type + content_type = (cls._meta.app_label + '_' + cls.__name__).lower() + + # Get parent content type + parent = cls.indexed_get_parent() + if parent: + parent_content_type = parent.indexed_get_content_type() + return parent_content_type + '_' + content_type + else: + return content_type + + @classmethod + def indexed_get_toplevel_content_type(cls): + # Get parent content type + parent = cls.indexed_get_parent() + if parent: + return parent.indexed_get_content_type() + else: + # At toplevel, return this content type + return (cls._meta.app_label + '_' + cls.__name__).lower() + + @classmethod + def get_search_fields(cls): + return cls.search_fields + + @classmethod + def get_searchable_search_fields(cls): + return filter(lambda field: isinstance(field, SearchField), cls.get_search_fields()) + + @classmethod + def get_filterable_search_fields(cls): + return filter(lambda field: isinstance(field, FilterField), cls.get_search_fields()) + + @classmethod + def get_indexed_objects(cls): + return cls.objects.all() + + search_fields = () + + +class BaseField(object): + suffix = '' + + def __init__(self, field_name, **kwargs): + self.field_name = field_name + self.kwargs = kwargs + + def get_field(self, cls): + return cls._meta.get_field_by_name(self.field_name)[0] + + def get_attname(self, cls): + try: + field = self.get_field(cls) + return field.attname + except models.fields.FieldDoesNotExist: + return self.field_name + + def get_index_name(self, cls): + return self.get_attname(cls) + self.suffix + + def get_type(self, cls): + if 'type' in self.kwargs: + return self.kwargs['type'] + + try: + field = self.get_field(cls) + return field.get_internal_type() + except models.fields.FieldDoesNotExist: + return 'CharField' + + def get_value(self, obj): + try: + field = self.get_field(obj.__class__) + return field._get_val_from_obj(obj) + except models.fields.FieldDoesNotExist: + value = getattr(obj, self.field_name, None) + if hasattr(value, '__call__'): + value = value() + return value + + def __repr__(self): + return '<%s: %s>' % (self.__class__.__name__, self.field_name) + + +class SearchField(BaseField): + def __init__(self, field_name, boost=None, partial_match=False, **kwargs): + super(SearchField, self).__init__(field_name, **kwargs) + self.boost = boost + self.partial_match = partial_match + + +class FilterField(BaseField): + suffix = '_filter' + diff --git a/wagtail/wagtailsearch/indexed.py b/wagtail/wagtailsearch/indexed.py index e775ff5c7..4ff8e7ba0 100644 --- a/wagtail/wagtailsearch/indexed.py +++ b/wagtail/wagtailsearch/indexed.py @@ -1,182 +1,11 @@ import warnings -from six import string_types - -from django.db import models - -from wagtail.utils.deprecation import RemovedInWagtail06Warning +from wagtail.utils.deprecation import RemovedInWagtail08Warning -class Indexed(object): - @classmethod - def indexed_get_parent(cls, require_model=True): - for base in cls.__bases__: - if issubclass(base, Indexed) and (issubclass(base, models.Model) or require_model is False): - return base - - @classmethod - def indexed_get_content_type(cls): - # Work out content type - content_type = (cls._meta.app_label + '_' + cls.__name__).lower() - - # Get parent content type - parent = cls.indexed_get_parent() - if parent: - parent_content_type = parent.indexed_get_content_type() - return parent_content_type + '_' + content_type - else: - return content_type - - @classmethod - def indexed_get_toplevel_content_type(cls): - # Get parent content type - parent = cls.indexed_get_parent() - if parent: - return parent.indexed_get_content_type() - else: - # At toplevel, return this content type - return (cls._meta.app_label + '_' + cls.__name__).lower() - - @classmethod - def indexed_get_indexed_fields(cls): - # Get indexed fields for this class as dictionary - indexed_fields = cls.indexed_fields - if isinstance(indexed_fields, dict): - # Make sure we have a copy to prevent us accidentally changing the configuration - indexed_fields = indexed_fields.copy() - else: - # Convert to dict - if isinstance(indexed_fields, tuple): - indexed_fields = list(indexed_fields) - if isinstance(indexed_fields, string_types): - indexed_fields = [indexed_fields] - if isinstance(indexed_fields, list): - indexed_fields = dict((field, dict(type='string')) for field in indexed_fields) - if not isinstance(indexed_fields, dict): - raise ValueError() - - # Get indexed fields for parent class - parent = cls.indexed_get_parent(require_model=False) - if parent: - # Add parent fields into this list - parent_indexed_fields = parent.indexed_get_indexed_fields().copy() - parent_indexed_fields.update(indexed_fields) - indexed_fields = parent_indexed_fields - return indexed_fields - - @classmethod - def get_search_fields(cls): - search_fields = [] - - if hasattr(cls, 'search_fields'): - search_fields.extend(cls.search_fields) - - # Backwards compatibility with old indexed_fields setting - - # Get indexed fields - indexed_fields = cls.indexed_get_indexed_fields() - - # Display deprecation warning if indexed_fields has been used - if indexed_fields: - warnings.warn("'indexed_fields' setting is now deprecated." - "Use 'search_fields' instead.", RemovedInWagtail06Warning) - - # Convert them into search fields - for field_name, _config in indexed_fields.items(): - # Copy the config to prevent is trashing anything accidentally - config = _config.copy() - - # Check if this is a filter field - if config.get('index', None) == 'not_analyzed': - config.pop('index') - search_fields.append(FilterField(field_name, es_extra=config)) - continue - - # Must be a search field, check for boosting and partial matching - boost = config.pop('boost', None) - - partial_match = False - if config.get('analyzer', None) == 'edgengram_analyzer': - partial_match = True - config.pop('analyzer') - - # Add the field - search_fields.append(SearchField(field_name, boost=boost, partial_match=partial_match, es_extra=config)) - - # Remove any duplicate entries into search fields - # We need to take into account that fields can be indexed as both a SearchField and as a FilterField - search_fields_dict = {} - for field in search_fields: - search_fields_dict[(field.field_name, type(field))] = field - search_fields = search_fields_dict.values() - - return search_fields - - @classmethod - def get_searchable_search_fields(cls): - return filter(lambda field: isinstance(field, SearchField), cls.get_search_fields()) - - @classmethod - def get_filterable_search_fields(cls): - return filter(lambda field: isinstance(field, FilterField), cls.get_search_fields()) - - @classmethod - def get_indexed_objects(cls): - return cls.objects.all() - - indexed_fields = () +warnings.warn( + "The wagtail.wagtailsearch.indexed module has been renamed. " + "Use wagtail.wagtailsearch.index instead.", RemovedInWagtail08Warning) -class BaseField(object): - suffix = '' - - def __init__(self, field_name, **kwargs): - self.field_name = field_name - self.kwargs = kwargs - - def get_field(self, cls): - return cls._meta.get_field_by_name(self.field_name)[0] - - def get_attname(self, cls): - try: - field = self.get_field(cls) - return field.attname - except models.fields.FieldDoesNotExist: - return self.field_name - - def get_index_name(self, cls): - return self.get_attname(cls) + self.suffix - - def get_type(self, cls): - if 'type' in self.kwargs: - return self.kwargs['type'] - - try: - field = self.get_field(cls) - return field.get_internal_type() - except models.fields.FieldDoesNotExist: - return 'CharField' - - def get_value(self, obj): - try: - field = self.get_field(obj.__class__) - return field._get_val_from_obj(obj) - except models.fields.FieldDoesNotExist: - value = getattr(obj, self.field_name, None) - if hasattr(value, '__call__'): - value = value() - return value - - def __repr__(self): - return '<%s: %s>' % (self.__class__.__name__, self.field_name) - - -class SearchField(BaseField): - def __init__(self, field_name, boost=None, partial_match=False, **kwargs): - super(SearchField, self).__init__(field_name, **kwargs) - self.boost = boost - self.partial_match = partial_match - - -class FilterField(BaseField): - suffix = '_filter' +from .index import * diff --git a/wagtail/wagtailsearch/locale/pt_PT/LC_MESSAGES/django.mo b/wagtail/wagtailsearch/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 000000000..1b03459c4 Binary files /dev/null and b/wagtail/wagtailsearch/locale/pt_PT/LC_MESSAGES/django.mo differ diff --git a/wagtail/wagtailsearch/locale/pt_PT/LC_MESSAGES/django.po b/wagtail/wagtailsearch/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 000000000..705ad9584 --- /dev/null +++ b/wagtail/wagtailsearch/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,237 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +# Translators: +# Gladson <gladsonbrito@gmail.com>, 2014 +msgid "" +msgstr "" +"Project-Id-Version: Wagtail 0.5.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-01 16:39+0100\n" +"PO-Revision-Date: 2014-08-03 01:58+0100\n" +"Last-Translator: Jose Lourenco <jose@lourenco.ws>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 1.5.4\n" +"Language: pt_PT\n" + +#: forms.py:9 +msgid "Search term(s)/phrase" +msgstr "Procurar termo(s)/frase" + +#: forms.py:10 +msgid "" +"Enter the full search string to match. An \n" +" exact match is required for your Editors Picks to be \n" +" displayed, wildcards are NOT allowed." +msgstr "" +"introduza a frase completa a procurar. É \n" +" necessária uma coincidência exacta com os termos de procura para que " +"as suas Seleções de Editor sejam \n" +" mostradas, caracteres de substituição (wildcards) NÃO são permitidos." + +#: forms.py:36 +msgid "Please specify at least one recommendation for this search term." +msgstr "" +"Por favor especifique pelo menos uma recomendação para este termo de procura." + +#: wagtail_hooks.py:23 templates/wagtailsearch/editorspicks/list.html:9 +msgid "Editors picks" +msgstr "Escolhas do editor" + +#: templates/wagtailsearch/editorspicks/add.html:3 +#: templates/wagtailsearch/editorspicks/add.html:5 +msgid "Add editor's pick" +msgstr "Adicionar escolha de editor" + +#: templates/wagtailsearch/editorspicks/add.html:10 +msgid "" +"\n" +" <p>Editors picks are a means of recommending specific pages " +"that might not organically come high up in search results. E.g recommending " +"your primary donation page to a user searching with a less common term like " +"\"<em>giving</em>\".</p>\n" +" " +msgstr "" +"\n" +" <p>Escolhas de Editores servem para recomendar páginas que " +"poderiam não ser selecionadas para aparecer em posição alta em resultados de " +"pesquisa. Por ex., recomendar a sua página principal de donativos para ser " +"pesquisada usando termos menos comuns como \"<em>dar</em>\".</p>\n" +" " + +#: templates/wagtailsearch/editorspicks/add.html:13 +msgid "" +"\n" +" <p>The \"Search term(s)/phrase\" field below must contain " +"the full and exact search for which you wish to provide recommended results, " +"<em>including</em> any misspellings/user error. To help, you can choose from " +"search terms that have been popular with users of your site.</p>\n" +" " +msgstr "" +"\n" +" <p>O campo \"Procurar termo(s)/frase\" abaixo tem de conter " +"a pesquisa completa e exata para a qual pretende indicar resultados " +"recomendados, <em>incluindo</em> quaisquer erros de ortografia/utilizador. " +"Para facilitar, pode escolher de entre termos de pesquisa que tenham sido " +"usados frequentemente por utilizadores do seu site.</p>\n" +" " + +#: templates/wagtailsearch/editorspicks/add.html:27 +#: templates/wagtailsearch/editorspicks/edit.html:19 +msgid "Save" +msgstr "Guardar" + +#: templates/wagtailsearch/editorspicks/confirm_delete.html:3 +#, python-format +msgid "Delete %(query)s" +msgstr "Eliminar %(query)s" + +#: templates/wagtailsearch/editorspicks/confirm_delete.html:5 +#: templates/wagtailsearch/editorspicks/edit.html:20 +#: templates/wagtailsearch/editorspicks/includes/editorspicks_form.html:6 +msgid "Delete" +msgstr "Eliminar" + +#: templates/wagtailsearch/editorspicks/confirm_delete.html:9 +msgid "Are you sure you want to delete all editors picks for this search term?" +msgstr "" +"Tem a certeza que pretende eliminar todas as escolhas de editores para este " +"termo de pesquisa?" + +#: templates/wagtailsearch/editorspicks/confirm_delete.html:12 +msgid "Yes, delete" +msgstr "Sim, eliminar" + +#: templates/wagtailsearch/editorspicks/edit.html:3 +#, python-format +msgid "Editing %(query)s" +msgstr "Editando %(query)s" + +#: templates/wagtailsearch/editorspicks/edit.html:5 +msgid "Editing" +msgstr "Editando" + +#: templates/wagtailsearch/editorspicks/index.html:3 +msgid "Search Terms" +msgstr "Procurar Termos" + +#: templates/wagtailsearch/editorspicks/index.html:17 +msgid "Editor's search picks" +msgstr "Procurar escolhas de editor" + +#: templates/wagtailsearch/editorspicks/index.html:18 +msgid "Add new editor's pick" +msgstr "Adicionar nova escolha de editor" + +#: templates/wagtailsearch/editorspicks/list.html:8 +msgid "Search term(s)" +msgstr "Procurar termo(s)" + +#: templates/wagtailsearch/editorspicks/list.html:10 +#: templates/wagtailsearch/queries/chooser/results.html:8 +msgid "Views (past week)" +msgstr "Visualizações (última semana)" + +#: templates/wagtailsearch/editorspicks/list.html:17 +msgid "Edit this pick" +msgstr "Editar esta escolha" + +#: templates/wagtailsearch/editorspicks/list.html:23 +msgid "None" +msgstr "Nenhuma" + +#: templates/wagtailsearch/editorspicks/results.html:5 +#, python-format +msgid "" +"\n" +" There is one match\n" +" " +msgid_plural "" +"\n" +" There are %(counter)s matches\n" +" " +msgstr[0] "" +"\n" +" Existe uma ocorrência\n" +" " +msgstr[1] "" +"\n" +" Existem %(counter)s ocorrências\n" +" " + +#: templates/wagtailsearch/editorspicks/results.html:18 +#, python-format +msgid "Sorry, no editor's picks match \"<em>%(query_string)s</em>\"" +msgstr "" +"Desculpe, nenhuma escolha de editor contém \"<em>%(query_string)s</em>\"" + +#: templates/wagtailsearch/editorspicks/results.html:21 +#, python-format +msgid "" +"No editor's picks have been created. Why not <a href=" +"\"%(wagtailsearch_editorspicks_add_url)s\">add one</a>?" +msgstr "" +"Nenhuma escolha de editor foi criada. Porque não <a href=" +"\"%(wagtailsearch_editorspicks_add_url)s\">adicionar uma</a>?" + +#: templates/wagtailsearch/editorspicks/includes/editorspicks_form.html:4 +msgid "Move up" +msgstr "Mover para cima" + +#: templates/wagtailsearch/editorspicks/includes/editorspicks_form.html:5 +msgid "Move down" +msgstr "Mover para baixo" + +#: templates/wagtailsearch/editorspicks/includes/editorspicks_form.html:10 +msgid "Editors pick" +msgstr "Escolha de editor" + +#: templates/wagtailsearch/editorspicks/includes/editorspicks_formset.html:14 +msgid "Add recommended page" +msgstr "Adicionar uma página recomendada" + +#: templates/wagtailsearch/queries/chooser/chooser.html:2 +msgid "Popular search terms" +msgstr "Termos de procura populares" + +#: templates/wagtailsearch/queries/chooser/chooser.html:11 +msgid "Search" +msgstr "Procurar" + +#: templates/wagtailsearch/queries/chooser/results.html:7 +msgid "Terms" +msgstr "Termos" + +#: templates/wagtailsearch/queries/chooser/results.html:22 +msgid "No results found" +msgstr "Nenhum resultado encontrado" + +#: views/editorspicks.py:47 +msgid "Search editor's picks" +msgstr "Procurar nas escolhas de editor" + +#: views/editorspicks.py:83 +msgid "Editor's picks for '{0}' created." +msgstr "Escolhas de editor para '{0}' criadas." + +#: views/editorspicks.py:89 +msgid "Recommendations have not been created due to errors" +msgstr "Recomendações não foram criadas devido a erros." + +#: views/editorspicks.py:117 +msgid "Editor's picks for '{0}' updated." +msgstr "Escolhas de editor para '{0}' atualizadas." + +#: views/editorspicks.py:123 +msgid "Recommendations have not been saved due to errors" +msgstr "Recomendações não foram guardadas devido a erros." + +#: views/editorspicks.py:142 +msgid "Editor's picks deleted." +msgstr "Escolhas de editor eliminadas." diff --git a/wagtail/wagtailsearch/migrations/0001_initial.py b/wagtail/wagtailsearch/migrations/0001_initial.py new file mode 100644 index 000000000..eebd11a6a --- /dev/null +++ b/wagtail/wagtailsearch/migrations/0001_initial.py @@ -0,0 +1,59 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0002_initial_data'), + ] + + operations = [ + migrations.CreateModel( + name='EditorsPick', + fields=[ + ('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)), + ('sort_order', models.IntegerField(blank=True, null=True, editable=False)), + ('description', models.TextField(blank=True)), + ('page', models.ForeignKey(to='wagtailcore.Page')), + ], + options={ + 'ordering': ('sort_order',), + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Query', + fields=[ + ('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)), + ('query_string', models.CharField(unique=True, max_length=255)), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='QueryDailyHits', + fields=[ + ('id', models.AutoField(serialize=False, auto_created=True, verbose_name='ID', primary_key=True)), + ('date', models.DateField()), + ('hits', models.IntegerField(default=0)), + ('query', models.ForeignKey(to='wagtailsearch.Query', related_name='daily_hits')), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.AlterUniqueTogether( + name='querydailyhits', + unique_together=set([('query', 'date')]), + ), + migrations.AddField( + model_name='editorspick', + name='query', + field=models.ForeignKey(to='wagtailsearch.Query', related_name='editors_picks'), + preserve_default=True, + ), + ] diff --git a/wagtail/wagtailsearch/migrations/__init__.py b/wagtail/wagtailsearch/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wagtail/wagtailsearch/models.py b/wagtail/wagtailsearch/models.py index f82bb2462..a24183ad9 100644 --- a/wagtail/wagtailsearch/models.py +++ b/wagtail/wagtailsearch/models.py @@ -4,7 +4,6 @@ from django.db import models from django.utils import timezone from django.utils.encoding import python_2_unicode_compatible -from wagtail.wagtailsearch import indexed from wagtail.wagtailsearch.utils import normalise_query_string, MAX_QUERY_STRING_LENGTH diff --git a/wagtail/wagtailsearch/signal_handlers.py b/wagtail/wagtailsearch/signal_handlers.py index 3550e5175..1c55eb59f 100644 --- a/wagtail/wagtailsearch/signal_handlers.py +++ b/wagtail/wagtailsearch/signal_handlers.py @@ -2,7 +2,7 @@ from django.db.models.signals import post_save, post_delete from django.db import models from django.conf import settings -from wagtail.wagtailsearch.indexed import Indexed +from wagtail.wagtailsearch.index import Indexed from wagtail.wagtailsearch.backends import get_search_backend diff --git a/wagtail/wagtailsearch/tests/test_indexed_class.py b/wagtail/wagtailsearch/tests/test_indexed_class.py index 983d8e0ba..61d290c39 100644 --- a/wagtail/wagtailsearch/tests/test_indexed_class.py +++ b/wagtail/wagtailsearch/tests/test_indexed_class.py @@ -2,7 +2,7 @@ import warnings from django.test import TestCase -from wagtail.wagtailsearch import indexed +from wagtail.wagtailsearch import index from wagtail.tests import models from wagtail.tests.utils import WagtailTestUtils @@ -15,39 +15,3 @@ class TestContentTypeNames(TestCase): def test_qualified_content_type_name(self): name = models.SearchTestChild.indexed_get_content_type() self.assertEqual(name, 'tests_searchtest_tests_searchtestchild') - - -class TestIndexedFieldsBackwardsCompatibility(TestCase, WagtailTestUtils): - def test_indexed_fields_backwards_compatibility(self): - # Get search fields - with self.ignore_deprecation_warnings(): - search_fields = models.SearchTestOldConfig.get_search_fields() - - search_fields_dict = dict( - ((field.field_name, type(field)), field) - for field in search_fields - ) - - # Check that the fields were found - self.assertEqual(len(search_fields_dict), 2) - self.assertIn(('title', indexed.SearchField), search_fields_dict.keys()) - self.assertIn(('live', indexed.FilterField), search_fields_dict.keys()) - - # Check that the title field has the correct settings - self.assertTrue(search_fields_dict[('title', indexed.SearchField)].partial_match) - self.assertEqual(search_fields_dict[('title', indexed.SearchField)].boost, 100) - - def test_indexed_fields_backwards_compatibility_list(self): - # Get search fields - with self.ignore_deprecation_warnings(): - search_fields = models.SearchTestOldConfigList.get_search_fields() - - search_fields_dict = dict( - ((field.field_name, type(field)), field) - for field in search_fields - ) - - # Check that the fields were found - self.assertEqual(len(search_fields_dict), 2) - self.assertIn(('title', indexed.SearchField), search_fields_dict.keys()) - self.assertIn(('content', indexed.SearchField), search_fields_dict.keys()) diff --git a/wagtail/wagtailsnippets/__init__.py b/wagtail/wagtailsnippets/__init__.py index e69de29bb..4b8d21cd7 100644 --- a/wagtail/wagtailsnippets/__init__.py +++ b/wagtail/wagtailsnippets/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.wagtailsnippets.apps.WagtailSnippetsAppConfig' diff --git a/wagtail/wagtailsnippets/apps.py b/wagtail/wagtailsnippets/apps.py new file mode 100644 index 000000000..f63d40759 --- /dev/null +++ b/wagtail/wagtailsnippets/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailSnippetsAppConfig(AppConfig): + name = 'wagtail.wagtailsnippets' + label = 'wagtailsnippets' + verbose_name = "Wagtail snippets" diff --git a/wagtail/wagtailsnippets/locale/pt_PT/LC_MESSAGES/django.mo b/wagtail/wagtailsnippets/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 000000000..eeab05613 Binary files /dev/null and b/wagtail/wagtailsnippets/locale/pt_PT/LC_MESSAGES/django.mo differ diff --git a/wagtail/wagtailsnippets/locale/pt_PT/LC_MESSAGES/django.po b/wagtail/wagtailsnippets/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 000000000..5c3b0b707 --- /dev/null +++ b/wagtail/wagtailsnippets/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,153 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: Wagtail 0.5.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-01 16:39+0100\n" +"PO-Revision-Date: 2014-08-03 01:58+0100\n" +"Last-Translator: Jose Lourenco <jose@lourenco.ws>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 1.5.4\n" +"Language: pt_PT\n" + +#: wagtail_hooks.py:25 templates/wagtailsnippets/snippets/index.html:3 +msgid "Snippets" +msgstr "Snippets" + +#: templates/wagtailsnippets/chooser/choose.html:2 +msgid "Choose" +msgstr "Escolher" + +#: templates/wagtailsnippets/edit_handlers/snippet_chooser_panel.html:10 +#, python-format +msgid "Choose another %(snippet_type_name)s" +msgstr "Escolher outro %(snippet_type_name)s" + +#: templates/wagtailsnippets/edit_handlers/snippet_chooser_panel.html:11 +#, python-format +msgid "Choose %(snippet_type_name)s" +msgstr "Escolher %(snippet_type_name)s" + +#: templates/wagtailsnippets/snippets/confirm_delete.html:3 +#, python-format +msgid "Delete %(snippet_type_name)s - %(instance)s" +msgstr "Eliminar %(snippet_type_name)s - %(instance)s" + +#: templates/wagtailsnippets/snippets/confirm_delete.html:6 +#: templates/wagtailsnippets/snippets/edit.html:20 +msgid "Delete" +msgstr "Eliminar" + +#: templates/wagtailsnippets/snippets/confirm_delete.html:10 +#, python-format +msgid "Are you sure you want to delete this %(snippet_type_name)s?" +msgstr "Tem a certeza que quer eliminar este %(snippet_type_name)s?" + +#: templates/wagtailsnippets/snippets/confirm_delete.html:13 +msgid "Yes, delete" +msgstr "Sim, eliminar" + +#: templates/wagtailsnippets/snippets/create.html:3 +#, python-format +msgid "New %(snippet_type_name)s" +msgstr "Novo %(snippet_type_name)s" + +#: templates/wagtailsnippets/snippets/create.html:6 +msgid "New" +msgstr "Novo" + +#: templates/wagtailsnippets/snippets/create.html:17 +#: templates/wagtailsnippets/snippets/edit.html:17 +msgid "Save" +msgstr "Guardar" + +#: templates/wagtailsnippets/snippets/edit.html:3 +#, python-format +msgid "Editing %(snippet_type_name)s - %(instance)s" +msgstr "Editando %(snippet_type_name)s - %(instance)s" + +#: templates/wagtailsnippets/snippets/edit.html:6 +msgid "Editing" +msgstr "Editando" + +#: templates/wagtailsnippets/snippets/list.html:8 +#: templates/wagtailsnippets/snippets/usage.html:16 +msgid "Title" +msgstr "Título" + +#: templates/wagtailsnippets/snippets/type_index.html:3 +#, python-format +msgid "Snippets %(snippet_type_name_plural)s" +msgstr "Snippets %(snippet_type_name_plural)s" + +#: templates/wagtailsnippets/snippets/type_index.html:10 +#, python-format +msgid "Snippets <span>%(snippet_type_name_plural)s</span>" +msgstr "Snippets <span>%(snippet_type_name_plural)s</span>" + +#: templates/wagtailsnippets/snippets/type_index.html:13 +#, python-format +msgid "Add %(snippet_type_name)s" +msgstr "Adicionar %(snippet_type_name)s" + +#: templates/wagtailsnippets/snippets/type_index.html:23 +#, python-format +msgid "" +"No %(snippet_type_name_plural)s have been created. Why not <a href=" +"\"%(wagtailsnippets_create_url)s\">add one</a>?" +msgstr "" +"Nenhum %(snippet_type_name_plural)s foi criado. Porque não <a href=" +"\"%(wagtailsnippets_create_url)s\">adicionar um</a>?" + +#: templates/wagtailsnippets/snippets/usage.html:3 +#, python-format +msgid "Usage of %(title)s" +msgstr "Utilização de %(title)s" + +#: templates/wagtailsnippets/snippets/usage.html:5 +msgid "Usage of" +msgstr "Utilização de" + +#: templates/wagtailsnippets/snippets/usage.html:17 +msgid "Parent" +msgstr "Ascendente" + +#: templates/wagtailsnippets/snippets/usage.html:18 +msgid "Type" +msgstr "Tipo" + +#: templates/wagtailsnippets/snippets/usage.html:19 +msgid "Status" +msgstr "Estado" + +#: templates/wagtailsnippets/snippets/usage.html:26 +msgid "Edit this page" +msgstr "Editar esta página" + +#: views/snippets.py:129 +msgid "{snippet_type} '{instance}' created." +msgstr "{snippet_type} '{instance}' atualizado." + +#: views/snippets.py:136 +msgid "The snippet could not be created due to errors." +msgstr "O snippet não pôde ser criado devido a erros." + +#: views/snippets.py:170 +msgid "{snippet_type} '{instance}' updated." +msgstr "{snippet_type} '{instance}' atualizado." + +#: views/snippets.py:177 +msgid "The snippet could not be saved due to errors." +msgstr "O snippet não pôde ser guardado devido a erros." + +#: views/snippets.py:206 +msgid "{snippet_type} '{instance}' deleted." +msgstr "{snippet_type} '{instance}' eliminado." diff --git a/wagtail/wagtailusers/__init__.py b/wagtail/wagtailusers/__init__.py index e69de29bb..088b3cb69 100644 --- a/wagtail/wagtailusers/__init__.py +++ b/wagtail/wagtailusers/__init__.py @@ -0,0 +1 @@ +default_app_config = 'wagtail.wagtailusers.apps.WagtailUsersAppConfig' diff --git a/wagtail/wagtailusers/apps.py b/wagtail/wagtailusers/apps.py new file mode 100644 index 000000000..055e18d99 --- /dev/null +++ b/wagtail/wagtailusers/apps.py @@ -0,0 +1,7 @@ +from django.apps import AppConfig + + +class WagtailUsersAppConfig(AppConfig): + name = 'wagtail.wagtailusers' + label = 'wagtailusers' + verbose_name = "Wagtail users" diff --git a/wagtail/wagtailusers/locale/pt_PT/LC_MESSAGES/django.mo b/wagtail/wagtailusers/locale/pt_PT/LC_MESSAGES/django.mo new file mode 100644 index 000000000..0698c96aa Binary files /dev/null and b/wagtail/wagtailusers/locale/pt_PT/LC_MESSAGES/django.mo differ diff --git a/wagtail/wagtailusers/locale/pt_PT/LC_MESSAGES/django.po b/wagtail/wagtailusers/locale/pt_PT/LC_MESSAGES/django.po new file mode 100644 index 000000000..abd1de940 --- /dev/null +++ b/wagtail/wagtailusers/locale/pt_PT/LC_MESSAGES/django.po @@ -0,0 +1,206 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. +# +# Translators: +# Thiago Cangussu <cangussu.thg@gmail.com>, 2014 +msgid "" +msgstr "" +"Project-Id-Version: Wagtail 0.5.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-08-01 16:39+0100\n" +"PO-Revision-Date: 2014-08-03 01:59+0100\n" +"Last-Translator: Jose Lourenco <jose@lourenco.ws>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"X-Generator: Poedit 1.5.4\n" +"Language: pt_PT\n" + +#: forms.py:18 forms.py:95 +msgid "Administrator" +msgstr "Administrador" + +#: forms.py:20 +msgid "If ticked, this user has the ability to manage user accounts." +msgstr "" +"Se selecionado, este utilizador terá permissão para gerir contas de " +"utilizadores." + +#: forms.py:23 forms.py:80 +msgid "Email" +msgstr "Email" + +#: forms.py:24 forms.py:81 +msgid "First Name" +msgstr "Primeiro Nome" + +#: forms.py:25 forms.py:82 +msgid "Last Name" +msgstr "Último nome" + +#: forms.py:68 +msgid "A user with that username already exists." +msgstr "Um utilizador com esse nome já existe." + +#: forms.py:69 +msgid "The two password fields didn't match." +msgstr "As senhas nos dois campos não coincidem." + +#: forms.py:72 templates/wagtailusers/list.html:15 +msgid "Username" +msgstr "Nome de utilizador" + +#: forms.py:75 +msgid "Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only." +msgstr "" +"Obrigatório. 30 caracteres ou menos. Somente letras, números e @/./+/-/_." + +#: forms.py:77 +msgid "This value may contain only letters, numbers and @/./+/-/_ characters." +msgstr "" +"Este valor apenas pode conter letras, números e os caracteres @/./+/-/_." + +#: forms.py:85 +msgid "Password" +msgstr "Senha" + +#: forms.py:88 +msgid "Leave blank if not changing." +msgstr "Deixar em branco se não houver alteração" + +#: forms.py:90 +msgid "Password confirmation" +msgstr "Confirmação de senha" + +#: forms.py:92 +msgid "Enter the same password as above, for verification." +msgstr "Introduza a mesma senha anterior para verificação." + +#: forms.py:97 +msgid "Administrators have the ability to manage user accounts." +msgstr "Os administradores têm a permissão para gerir contas de utilizadores." + +#: models.py:13 +msgid "Receive notification when a page is submitted for moderation" +msgstr "Receber notificação quando uma página for enviada para moderação" + +#: models.py:18 +msgid "Receive notification when your page edit is approved" +msgstr "Receber notificação quando a edição da sua página for aprovada" + +#: models.py:23 +msgid "Receive notification when your page edit is rejected" +msgstr "Receber notificação quando a edição da sua página for rejeitada" + +#: wagtail_hooks.py:22 templates/wagtailusers/index.html:4 +#: templates/wagtailusers/index.html:17 +msgid "Users" +msgstr "Utilizadores" + +#: templates/wagtailusers/create.html:4 templates/wagtailusers/create.html:8 +#: templates/wagtailusers/create.html:35 +msgid "Add user" +msgstr "Adicionar utilizador" + +#: templates/wagtailusers/create.html:12 templates/wagtailusers/edit.html:12 +msgid "Account" +msgstr "Conta" + +#: templates/wagtailusers/create.html:13 templates/wagtailusers/create.html:28 +#: templates/wagtailusers/edit.html:13 +msgid "Roles" +msgstr "Funções (roles)" + +#: templates/wagtailusers/edit.html:4 templates/wagtailusers/edit.html.py:8 +msgid "Editing" +msgstr "Editando" + +#: templates/wagtailusers/edit.html:30 templates/wagtailusers/edit.html:37 +msgid "Save" +msgstr "Guardar" + +#: templates/wagtailusers/index.html:18 +msgid "Add a user" +msgstr "Adicionar um utilizador" + +#: templates/wagtailusers/list.html:7 +msgid "Name" +msgstr "Nome" + +#: templates/wagtailusers/list.html:22 +msgid "Level" +msgstr "Nível" + +#: templates/wagtailusers/list.html:23 +msgid "Status" +msgstr "Estado" + +#: templates/wagtailusers/list.html:36 +msgid "Admin" +msgstr "Admin" + +#: templates/wagtailusers/list.html:37 +msgid "Active" +msgstr "Ativo" + +#: templates/wagtailusers/list.html:37 +msgid "Inactive" +msgstr "Inativo" + +#: templates/wagtailusers/results.html:5 +#, python-format +msgid "" +"\n" +" There is one match\n" +" " +msgid_plural "" +"\n" +" There are %(counter)s matches\n" +" " +msgstr[0] "" +"\n" +" Existe uma correspondência\n" +" " +msgstr[1] "" +"\n" +" Existem %(counter)s correspondências\n" +" " + +#: templates/wagtailusers/results.html:18 +#, python-format +msgid "Sorry, no users match \"<em>%(query_string)s</em>\"" +msgstr "" +"Desculpe, nenhum utilizador corresponde a \"<em>%(query_string)s</em>\"" + +#: templates/wagtailusers/results.html:21 +#, python-format +msgid "" +"There are no users configured. Why not <a href=\"%(wagtailusers_create_url)s" +"\">add some</a>?" +msgstr "" +"Não existem utilizadores configurados. Por que não <a href=" +"\"%(wagtailusers_create_url)s\">adicionar algum</a>?" + +#: views/users.py:30 views/users.py:37 +msgid "Search users" +msgstr "Procurar utilizadores" + +#: views/users.py:84 +msgid "User '{0}' created." +msgstr "Utilizador '{0}' criado." + +#: views/users.py:87 +msgid "The user could not be created due to errors." +msgstr "O utilizador não pôde ser criado devido a erros." + +#: views/users.py:103 +msgid "User '{0}' updated." +msgstr "Utilizador '{0}' atualizado." + +#: views/users.py:106 +msgid "The user could not be saved due to errors." +msgstr "O utilizador não pôde ser guardado devido a erros." diff --git a/wagtail/wagtailusers/migrations/0001_initial.py b/wagtail/wagtailusers/migrations/0001_initial.py new file mode 100644 index 000000000..e1968c0f1 --- /dev/null +++ b/wagtail/wagtailusers/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='UserProfile', + fields=[ + ('id', models.AutoField(serialize=False, verbose_name='ID', auto_created=True, primary_key=True)), + ('submitted_notifications', models.BooleanField(default=True, help_text='Receive notification when a page is submitted for moderation')), + ('approved_notifications', models.BooleanField(default=True, help_text='Receive notification when your page edit is approved')), + ('rejected_notifications', models.BooleanField(default=True, help_text='Receive notification when your page edit is rejected')), + ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)), + ], + options={ + }, + bases=(models.Model,), + ), + ] diff --git a/wagtail/wagtailusers/migrations/__init__.py b/wagtail/wagtailusers/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb