diff --git a/CHANGELOG.txt b/CHANGELOG.txt index ca58949b4..8ebe93959 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -4,6 +4,7 @@ Changelog 0.4 (xx.xx.20xx) ~~~~~~~~~~~~~~~~ * ElasticUtils/pyelasticsearch swapped for elasticsearch-py + * Added notification preferences * Added 'original' as a resizing rule supported by the 'image' tag * Hallo.js updated to version 1.0.4 * Snippets are now ordered alphabetically @@ -16,9 +17,14 @@ Changelog * 'image' tag now accepts extra keyword arguments to be output as attributes on the img tag * Added an 'attrs' property to image rendition objects to output src, width, height and alt attributes all in one go * Added 'construct_whitelister_element_rules' hook for customising the HTML whitelist used when saving rich text fields + * Added 'in_menu' and 'not_in_menu' methods to PageQuerySet + * Added 'get_next_siblings' and 'get_prev_siblings' to Page + * Added init_new_page signal * Fix: Animated GIFs are now coalesced before resizing * Fix: Wand backend clones images before modifying them * Fix: Admin breadcrumb now positioned correctly on mobile + * Fix: Page chooser breadcrumb now updates the chooser modal instead of linking to Explorer + * Fix: Embeds - Fixed crash when no HTML field is sent back from the embed provider 0.3.1 (03.06.2014) ~~~~~~~~~~~~~~~~~~ diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index fcba8d2d7..df81741c9 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -29,6 +29,7 @@ Contributors * Tom Talbot * Jeffrey Hearn * Robert Clark +* Tim Heap Translators =========== diff --git a/docs/building_your_site/djangodevelopers.rst b/docs/building_your_site/djangodevelopers.rst index b4899d70f..aeabb264f 100644 --- a/docs/building_your_site/djangodevelopers.rst +++ b/docs/building_your_site/djangodevelopers.rst @@ -1,9 +1,15 @@ For Django developers ===================== +.. contents:: Contents + :local: + .. note:: This documentation is currently being written. +Overview +~~~~~~~~ + Wagtail requires a little careful setup to define the types of content that you want to present through your website. The basic unit of content in Wagtail is the ``Page``, and all of your page-level content will inherit basic webpage-related properties from it. But for the most part, you will be defining content yourself, through the construction of Django models using Wagtail's ``Page`` as a base. Wagtail organizes content created from your models in a tree, which can have any structure and combination of model objects in it. Wagtail doesn't prescribe ways to organize and interrelate your content, but here we've sketched out some strategies for organizing your models. @@ -203,7 +209,6 @@ Methods: * get_context * get_template * is_navigable -* get_other_siblings * get_ancestors * get_descendants * get_siblings @@ -269,6 +274,7 @@ not_type(self, model): return self.get_query_set().not_type(model) +.. _wagtail_site_admin: Site ~~~~ @@ -278,3 +284,13 @@ Django's built-in admin interface provides the way to map a "site" (hostname or 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. + + +.. _redirects: + +Redirects +~~~~~~~~~ + +Wagtail provides a simple interface for creating arbitrary redirects to and from any URL. + +.. image:: ../images/screen_wagtail_redirects.png diff --git a/docs/building_your_site/frontenddevelopers.rst b/docs/building_your_site/frontenddevelopers.rst index 8d0c9a3bb..35aa1c845 100644 --- a/docs/building_your_site/frontenddevelopers.rst +++ b/docs/building_your_site/frontenddevelopers.rst @@ -1,7 +1,8 @@ For Front End developers ======================== -.. contents:: +.. contents:: Contents + :local: ======================== Overview @@ -90,6 +91,9 @@ In addition to Django's standard tags and filters, Wagtail provides some of its Images (tag) ~~~~~~~~~~~~ +.. versionchanged:: 0.4 + The 'image_tags' tags library was renamed to 'wagtailimages_tags' + The ``image`` tag inserts an XHTML-compatible ``img`` element into the page, setting its ``src``, ``width``, ``height`` and ``alt``. See also :ref:`image_tag_alt`. The syntax for the tag is thus:: @@ -100,7 +104,7 @@ For example: .. code-block:: django - {% load image %} + {% load wagtailimages_tags %} ... {% image self.photo width-400 %} @@ -205,7 +209,7 @@ No validation is performed on attributes add in this way by the developer. It's Wagtail can assign the image data to another object using Django's ``as`` syntax: .. code-block:: django - + {% image self.photo width-400 as tmp_photo %} @@ -287,7 +297,7 @@ Takes any ``slug`` as defined in a page's "Promote" tab and returns the URL for .. code-block:: django - {% load slugurl %} + {% load wagtailcore_tags %} ... diff --git a/docs/editing_api.rst b/docs/editing_api.rst index 9f7602b11..c32b54d35 100644 --- a/docs/editing_api.rst +++ b/docs/editing_api.rst @@ -1,5 +1,5 @@ -Editing API +Defining models with the Editing API =========== .. note:: @@ -22,18 +22,30 @@ Defining Panels A "panel" is the basic editing block in Wagtail. Wagtail will automatically pick the appropriate editing widget for most Django field types, you just need to add a panel for each field you want to show in the Wagtail page editor, in the order you want them to appear. -There are three types of panels: - +There are four basic types of panels: + ``FieldPanel( field_name, classname=None )`` This is the panel used for basic Django field types. ``field_name`` is the name of the class property used in your model definition. ``classname`` is a string of optional CSS classes given to the panel which are used in formatting and scripted interactivity. By default, panels are formatted as inset fields. The CSS class ``full`` can be used to format the panel so it covers the full width of the Wagtail page editor. The CSS class ``title`` can be used to mark a field as the source for auto-generated slug strings. ``MultiFieldPanel( children, heading="", classname=None )`` This panel condenses several ``FieldPanel`` s or choosers, from a list or tuple, under a single ``heading`` string. - ``InlinePanel( base_model, relation_name, panels=None, label='', help_text='' )`` + ``InlinePanel( base_model, relation_name, panels=None, classname=None, label='', help_text='' )`` This panel allows for the creation of a "cluster" of related objects over a join to a separate model, such as a list of related links or slides to an image carousel. This is a very powerful, but tricky feature which will take some space to cover, so we'll skip over it for now. For a full explanation on the usage of ``InlinePanel``, see :ref:`inline_panels`. -Wagtail provides a tabbed interface to help organize panels. ``content_panels`` is the main tab, used for the meat of your model content. The other, ``promote_panels``, is suggested for organizing metadata about the content, such as SEO information and other machine-readable information. Since you're writing the panel definitions, you can organize them however you want. + ``FieldRowPanel( children, classname=None)`` + This panel is purely aesthetic. It creates a columnar layout in the editing interface, where each of the child Panels appears alongside each others rather than below. Use of FieldRowPanel particularly helps reduce the "snow-blindness" effect of seeing so many fields on the page, for complex models. It also improves the perceived association between fields of a similar nature. For example if you created a model representing an "Event" which had a starting date and ending date, it would be intuitive to find the start and end date on the same "row". + + FieldRowPanel should be used in combination with ``col*`` classnames added to each of the child Panels of the FieldRowPanel. The Wagtail editing interface is layed out using a grid system, in which the maximum width of the editor is 12 columns wide. Classes ``col1``-``col12`` can be applied to each child of a FieldRowPanel. The class ``col3`` will ensure that field appears 3 columns wide or a quarter the width. ``col4`` would cause the field to be 4 columns wide, or a third the width. + + **(In addition to these four, there are also Chooser Panels, detailed below.)** + + +Wagtail provides a tabbed interface to help organize panels. Three such tabs are provided: + +* ``content_panels`` is the main tab, used for the bulk of your model's fields. +* ``promote_panels`` is suggested for organizing fields regarding the promotion of the page around the site and the internet e.g A field to dictate whether the page should show in site-wide menus, descriptive text that should appear in site search results, SEO friendly titles, OpenGraph meta tag content and other machine-readable information. +* ``settings_panels`` is essentially for non-copy fields. By default it contains the page's scheduled publishing fields. Other suggested fields e.g: a field to switch between one layout/style and another. Let's look at an example of a panel definition: @@ -55,7 +67,10 @@ Let's look at an example of a panel definition: ExamplePage.content_panels = [ FieldPanel('title', classname="full title"), FieldPanel('body', classname="full"), - FieldPanel('date'), + FieldRowPanel([ + FieldPanel('start_date', classname="col3"), + FieldPanel('end_date', classname="col3"), + ]), ImageChooserPanel('splash_image'), DocumentChooserPanel('free_download'), PageChooserPanel('related_page'), @@ -254,6 +269,12 @@ Titles Use ``classname="title"`` to make Page's built-in title field stand out with more vertical padding. +Col* +------ + +Fields within a ``FieldRowPanel`` can have their width dictated in terms of the number of columns it should span. The ``FieldRowPanel`` is always considered to be 12 columns wide regardless of browser size or the nesting of ``FieldRowPanel`` in any other type of panel. Specify a number of columns thus: ``col3``, ``col4``, ``col6`` etc (up to 12). The resulting width with be *relative* to the full width of the ``FieldRowPanel``. + + Required Fields --------------- @@ -346,9 +367,9 @@ The ``RelatedLink`` class is a vanilla Django abstract model. The ``BookPageRela For another example of using model clusters, see :ref:`tagging` -For more on ``django-modelcluster``, visit `the django-modelcluster github project page`_ ). +For more on ``django-modelcluster``, visit `the django-modelcluster github project page`_. -.. _the django-modelcluster github page: https://github.com/torchbox/django-modelcluster +.. _the django-modelcluster github project page: https://github.com/torchbox/django-modelcluster .. _extending_wysiwyg: diff --git a/docs/editor_manual/new_pages/inserting_videos.rst b/docs/editor_manual/new_pages/inserting_videos.rst index 038f3e427..1b32c0d1c 100644 --- a/docs/editor_manual/new_pages/inserting_videos.rst +++ b/docs/editor_manual/new_pages/inserting_videos.rst @@ -1,3 +1,6 @@ + +.. _inserting_videos: + Inserting videos into body content ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -9,4 +12,4 @@ As well as inserting videos into a carousel, Wagtail's rich text fields allow yo .. image:: ../../images/screen21_video_in_editor.png -* A placeholder with the name of the video and a screenshot will be inserted into the text area. Clicking the X in the top corner will remove the video. \ No newline at end of file +* A placeholder with the name of the video and a screenshot will be inserted into the text area. Clicking the X in the top corner will remove the video. diff --git a/docs/form_builder.rst b/docs/form_builder.rst index 9aa220e19..a141cc376 100644 --- a/docs/form_builder.rst +++ b/docs/form_builder.rst @@ -1,3 +1,6 @@ + +.. _form_builder: + Form builder ============ diff --git a/docs/images/screen_wagtail_redirects.png b/docs/images/screen_wagtail_redirects.png new file mode 100644 index 000000000..516bdd046 Binary files /dev/null and b/docs/images/screen_wagtail_redirects.png differ diff --git a/docs/index.rst b/docs/index.rst index abbb7fdbe..a35560f82 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,6 +9,7 @@ It supports Django 1.6.2+ on Python 2.6 and 2.7. Django 1.7 and Python 3 support :maxdepth: 3 gettingstarted + settings building_your_site/index editing_api snippets diff --git a/docs/management_commands.rst b/docs/management_commands.rst new file mode 100644 index 000000000..e5f6393f7 --- /dev/null +++ b/docs/management_commands.rst @@ -0,0 +1,59 @@ +Management commands +=================== + +publish_scheduled_pages +----------------------- + +**./manage.py publish_scheduled_pages** + +This command publishes/unpublishes pages that have had these actions scheduled by an editor. + +It is recommended to run this command once an hour. + + +fixtree +------- + +**./manage.py fixtree** + +This command scans for errors in your database and attempts to fix any issues it finds. + + +move_pages +---------- + +**./manage.py move_pages from to** + +This mass moves a bunch of pages from one section of the tree to another. + +Options: + + - **from** + This is id of the page to move pages from. All descendants of this page will be moved to the destination. After the operation is complete, this page will have no children. + + - **to** + This is the id of the page to move pages to. + + +update_index +------------ + +**./manage.py update_index** + +This command rebuilds the search index from scratch. It is only required when using ElasticSearch. + +It is recommended to run this command once a week and at the following times: + - Whenever any pages have been created through a script (eg, import) + - Whenever any changes have been made to models or search configuration + +While this command is running, the search may not return any results so avoid running this command at peak times. + + +search_garbage_collect +---------------------- + +**./manage.py search_garbage_collect** + +Wagtail keeps a log of search queries that are popular on your website. On high traffic websites, this log may get big and sometimes you may want to clean out old search queries. + +This command cleans out all search query logs that are more than one week old. diff --git a/docs/settings.rst b/docs/settings.rst new file mode 100644 index 000000000..018af5d01 --- /dev/null +++ b/docs/settings.rst @@ -0,0 +1,603 @@ + +============================== +Configuring Django for Wagtail +============================== + +To install Wagtail completely from scratch, create a new Django project and an app within that project. For instructions on these tasks, see `Writing your first Django app`_. Your project directory will look like the following:: + + myproject/ + myproject/ + __init__.py + settings.py + urls.py + wsgi.py + myapp/ + __init__.py + models.py + tests.py + admin.py + views.py + manage.py + +From your app directory, you can safely remove ``admin.py`` and ``views.py``, since Wagtail will provide this functionality for your models. Configuring Django to load Wagtail involves adding modules and variables to ``settings.py`` and urlconfs to ``urls.py``. For a more complete view of what's defined in these files, see `Django Settings`_ and `Django URL Dispatcher`_. + +.. _Writing your first Django app: https://docs.djangoproject.com/en/dev/intro/tutorial01/ + +.. _Django Settings: https://docs.djangoproject.com/en/dev/topics/settings/ + +.. _Django URL Dispatcher: https://docs.djangoproject.com/en/dev/topics/http/urls/ + +What follows is a settings reference which skips many boilerplate Django settings. If you just want to get your Wagtail install up quickly without fussing with settings at the moment, see :ref:`complete_example_config`. + + +Middleware (settings.py) +~~~~~~~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + + 'wagtail.wagtailcore.middleware.SiteMiddleware', + + 'wagtail.wagtailredirects.middleware.RedirectMiddleware', + ) + +Wagtail requires several common Django middleware modules to work and cover basic security. Wagtail provides its own middleware to cover these tasks: + +``SiteMiddleware`` + Wagtail routes pre-defined hosts to pages within the Wagtail tree using this middleware. For configuring sites, see :ref:`wagtail_site_admin`. + +``RedirectMiddleware`` + Wagtail provides a simple interface for adding arbitrary redirects to your site and this module makes it happen. + + +Apps (settings.py) +~~~~~~~~~~~~~~~~~~ + +.. code-block:: python + + INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + + 'south', + 'compressor', + 'taggit', + 'modelcluster', + 'django.contrib.admin', + + 'wagtail.wagtailcore', + 'wagtail.wagtailadmin', + 'wagtail.wagtaildocs', + 'wagtail.wagtailsnippets', + 'wagtail.wagtailusers', + 'wagtail.wagtailimages', + 'wagtail.wagtailembeds', + 'wagtail.wagtailsearch', + 'wagtail.wagtailredirects', + 'wagtail.wagtailforms', + + 'myapp', # your own app + ) + +Wagtail requires several Django app modules, third-party apps, and defines several apps of its own. Wagtail was built to be modular, so many Wagtail apps can be omitted to suit your needs. Your own app (here ``myapp``) is where you define your models, templates, static assets, template tags, and other custom functionality for your site. + + +Third-Party Apps +---------------- + +``south`` + Used for database migrations. See `South Documentation`_. + +.. _South Documentation: http://south.readthedocs.org/en/latest/ + +``compressor`` + Static asset combiner and minifier for Django. Compressor also enables for the use of preprocessors. See `Compressor Documentation`_. + +.. _Compressor Documentation: http://django-compressor.readthedocs.org/en/latest/ + +``taggit`` + Tagging framework for Django. This is used internally within Wagtail for image and document tagging and is available for your own models as well. See :ref:`tagging` for a Wagtail model recipe or the `Taggit Documentation`_. + +.. _Taggit Documentation: http://django-taggit.readthedocs.org/en/latest/index.html + +``modelcluster`` + Extension of Django ForeignKey relation functionality, which is used in Wagtail pages for on-the-fly related object creation. For more information, see :ref:`inline_panels` or `the django-modelcluster github project page`_. + +.. _the django-modelcluster github project page: https://github.com/torchbox/django-modelcluster + +``django.contrib.admin`` + The Django admin module. While Wagtail will eventually provide a sites-editing interface, the Django admin is included for now to provide that functionality. + + +Wagtail Apps +------------ + +``wagtailcore`` + The core functionality of Wagtail, such as the ``Page`` class, the Wagtail tree, and model fields. + +``wagtailadmin`` + The administration interface for Wagtail, including page edit handlers. + +``wagtaildocs`` + The Wagtail document content type. + +``wagtailsnippets`` + Editing interface for non-Page models and objects. See :ref:`Snippets`. + +``wagtailusers`` + User editing interface. + +``wagtailimages`` + The Wagtail image content type. + +``wagtailembeds`` + Module governing oEmbed and Embedly content in Wagtail rich text fields. See :ref:`inserting_videos`. + +``wagtailsearch`` + Search framework for Page content. See :ref:`search`. + +``wagtailredirects`` + Admin interface for creating arbitrary redirects on your site. See :ref:`redirects`. + +``wagtailforms`` + Models for creating forms on your pages and viewing submissions. See :ref:`form_builder`. + + +Settings Variables (settings.py) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Authentication +-------------- + +.. code-block:: python + + LOGIN_URL = 'wagtailadmin_login' + LOGIN_REDIRECT_URL = 'wagtailadmin_home' + +These settings variables set the Django authentication system to redirect to the Wagtail admin login. If you plan to use the Django authentication module to log in non-privileged users, you should set these variables to your own login views. See `Django User Authentication`_. + +.. _Django User Authentication: https://docs.djangoproject.com/en/dev/topics/auth/ + + +Site Name +--------- + +.. code-block:: python + + WAGTAIL_SITE_NAME = 'Stark Industries Skunkworks' + +This is the human-readable name of your Wagtail install which welcomes users upon login to the Wagtail admin. + + +Search +------ + +.. code-block:: python + + # Override the search results template for wagtailsearch + WAGTAILSEARCH_RESULTS_TEMPLATE = 'myapp/search_results.html' + WAGTAILSEARCH_RESULTS_TEMPLATE_AJAX = 'myapp/includes/search_listing.html' + + # Replace the search backend + WAGTAILSEARCH_BACKENDS = { + 'default': { + 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch', + 'INDEX': 'myapp' + } + } + +The search settings customize the search results templates as well as choosing a custom backend for search. For a full explanation, see :ref:`search`. + + +Embeds +------ + +Wagtail uses the oEmbed standard with a large but not comprehensive number of "providers" (youtube, vimeo, etc.). You can also use a different embed backend by providing an Embedly key or replacing the embed backend by writing your own embed finder function. + +.. code-block:: python + + WAGTAILEMBEDS_EMBED_FINDER = 'myapp.embeds.my_embed_finder_function' + +Use a custom embed finder function, which takes a URL and returns a dict with metadata and embeddable HTML. Refer to the ``wagtail.wagtailemebds.embeds`` module source for more information and examples. + +.. code-block:: python + + # not a working key, get your own! + EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830' + +Providing an API key for the Embedly service will use that as a embed backend, with a more extensive list of providers, as well as analytics and other features. For more information, see `Embedly`_. + +.. _Embedly: http://embed.ly/ + +To use Embedly, you must also install their python module: + +.. code-block:: bash + + $ pip install embedly + + +Images +------ + +.. code-block:: python + + WAGTAILIMAGES_IMAGE_MODEL = 'myapp.MyImage' + +This setting lets you provide your own image model for use in Wagtail, which might extend the built-in ``AbstractImage`` class or replace it entirely. + + +Email Notifications +------------------- + +.. code-block:: python + + WAGTAILADMIN_NOTIFICATION_FROM_EMAIL = 'wagtail@myhost.io' + +Wagtail sends email notifications when content is submitted for moderation, and when the content is accepted or rejected. This setting lets you pick which email address these automatic notifications will come from. If omitted, Django will fall back to using the ``DEFAULT_FROM_EMAIL`` variable if set, and ``webmaster@localhost`` if not. + + +Other Django Settings Used by Wagtail +------------------------------------- + +.. code-block:: python + + ALLOWED_HOSTS + APPEND_SLASH + AUTH_USER_MODEL + BASE_URL + CACHES + DEFAULT_FROM_EMAIL + INSTALLED_APPS + MEDIA_ROOT + SESSION_COOKIE_DOMAIN + SESSION_COOKIE_NAME + SESSION_COOKIE_PATH + STATIC_URL + TEMPLATE_CONTEXT_PROCESSORS + USE_I18N + +For information on what these settings do, see `Django Settings`_. + +.. _Django Settings: https://docs.djangoproject.com/en/dev/ref/settings/ + + +Search Signal Handlers +---------------------- + +.. code-block:: python + + from wagtail.wagtailsearch import register_signal_handlers as wagtailsearch_register_signal_handlers + + wagtailsearch_register_signal_handlers() + +This loads Wagtail's search signal handlers, which need to be loaded very early in the Django life cycle. While not technically a urlconf, this is a convenient place to load them. Calling this function registers signal handlers to watch for when indexed models get saved or deleted. This allows wagtailsearch to update ElasticSearch automatically. + + +URL Patterns +------------ + +.. code-block:: python + + from django.contrib import admin + + from wagtail.wagtailcore import urls as wagtail_urls + from wagtail.wagtailadmin import urls as wagtailadmin_urls + from wagtail.wagtaildocs import urls as wagtaildocs_urls + from wagtail.wagtailsearch.urls import frontend as wagtailsearch_frontend_urls + + admin.autodiscover() + + urlpatterns = patterns('', + url(r'^django-admin/', include(admin.site.urls)), + + url(r'^admin/', include(wagtailadmin_urls)), + url(r'^search/', include(wagtailsearch_frontend_urls)), + url(r'^documents/', include(wagtaildocs_urls)), + + # Optional urlconf for including your own vanilla Django urls/views + url(r'', include('myapp.urls')), + + # For anything not caught by a more specific rule above, hand over to + # Wagtail's serving mechanism + url(r'', include(wagtail_urls)), + ) + +This block of code for your project's ``urls.py`` does a few things: + +* Load the vanilla Django admin interface to ``/django-admin/`` +* Load the Wagtail admin and its various apps +* Dispatch any vanilla Django apps you're using other than Wagtail which require their own urlconfs (this is optional, since Wagtail might be all you need) +* Lets Wagtail handle any further URL dispatching. + +That's not everything you might want to include in your project's urlconf, but it's what's necessary for Wagtail to flourish. + + +.. _complete_example_config: + +Ready to Use Example Config Files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +These two files should reside in your project directory (``myproject/myproject/``). + + +settings.py +----------- + +.. code-block:: python + + import os + + PROJECT_ROOT = os.path.join(os.path.dirname(__file__), '..', '..') + + DEBUG = True + TEMPLATE_DEBUG = DEBUG + + ADMINS = ( + # ('Your Name', 'your_email@example.com'), + ) + + MANAGERS = ADMINS + + # Default to dummy email backend. Configure dev/production/local backend + # as per https://docs.djangoproject.com/en/dev/topics/email/#email-backends + EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend' + + DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'myprojectdb', + 'USER': 'postgres', + 'PASSWORD': '', + 'HOST': '', # Set to empty string for localhost. + 'PORT': '', # Set to empty string for default. + 'CONN_MAX_AGE': 600, # number of seconds database connections should persist for + } + } + + # Hosts/domain names that are valid for this site; required if DEBUG is False + # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts + ALLOWED_HOSTS = [] + + # Local time zone for this installation. Choices can be found here: + # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name + # although not all choices may be available on all operating systems. + # On Unix systems, a value of None will cause Django to use the same + # timezone as the operating system. + # If running in a Windows environment this must be set to the same as your + # system time zone. + TIME_ZONE = 'Europe/London' + + # Language code for this installation. All choices can be found here: + # http://www.i18nguy.com/unicode/language-identifiers.html + LANGUAGE_CODE = 'en-gb' + + SITE_ID = 1 + + # If you set this to False, Django will make some optimizations so as not + # to load the internationalization machinery. + USE_I18N = True + + # If you set this to False, Django will not format dates, numbers and + # calendars according to the current locale. + # Note that with this set to True, Wagtail will fall back on using numeric dates + # in date fields, as opposed to 'friendly' dates like "24 Sep 2013", because + # Python's strptime doesn't support localised month names: https://code.djangoproject.com/ticket/13339 + USE_L10N = False + + # If you set this to False, Django will not use timezone-aware datetimes. + USE_TZ = True + + # Absolute filesystem path to the directory that will hold user-uploaded files. + # Example: "/home/media/media.lawrence.com/media/" + MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media') + + # URL that handles the media served from MEDIA_ROOT. Make sure to use a + # trailing slash. + # Examples: "http://media.lawrence.com/media/", "http://example.com/media/" + MEDIA_URL = '/media/' + + # Absolute path to the directory static files should be collected to. + # Don't put anything in this directory yourself; store your static files + # in apps' "static/" subdirectories and in STATICFILES_DIRS. + # Example: "/home/media/media.lawrence.com/static/" + STATIC_ROOT = os.path.join(PROJECT_ROOT, 'static') + + # URL prefix for static files. + # Example: "http://media.lawrence.com/static/" + STATIC_URL = '/static/' + + # List of finder classes that know how to find static files in + # various locations. + STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + 'compressor.finders.CompressorFinder', + ) + + # Make this unique, and don't share it with anybody. + SECRET_KEY = 'change-me' + + # List of callables that know how to import templates from various sources. + TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + ) + + MIDDLEWARE_CLASSES = ( + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', + + 'wagtail.wagtailcore.middleware.SiteMiddleware', + + 'wagtail.wagtailredirects.middleware.RedirectMiddleware', + ) + + from django.conf import global_settings + TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + ( + 'django.core.context_processors.request', + ) + + ROOT_URLCONF = 'myproject.urls' + + # Python dotted path to the WSGI application used by Django's runserver. + WSGI_APPLICATION = 'wagtaildemo.wsgi.application' + + INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', + + 'south', + 'compressor', + 'taggit', + 'modelcluster', + 'django.contrib.admin', + + 'wagtail.wagtailcore', + 'wagtail.wagtailadmin', + 'wagtail.wagtaildocs', + 'wagtail.wagtailsnippets', + 'wagtail.wagtailusers', + 'wagtail.wagtailimages', + 'wagtail.wagtailembeds', + 'wagtail.wagtailsearch', + 'wagtail.wagtailredirects', + 'wagtail.wagtailforms', + + 'myapp', + ) + + EMAIL_SUBJECT_PREFIX = '[Wagtail] ' + + INTERNAL_IPS = ('127.0.0.1', '10.0.2.2') + + # django-compressor settings + COMPRESS_PRECOMPILERS = ( + ('text/x-scss', 'django_libsass.SassCompiler'), + ) + + # Auth settings + LOGIN_URL = 'wagtailadmin_login' + LOGIN_REDIRECT_URL = 'wagtailadmin_home' + + # A sample logging configuration. The only tangible logging + # performed by this configuration is to send an email to + # the site admins on every HTTP 500 error when DEBUG=False. + # See http://docs.djangoproject.com/en/dev/topics/logging for + # more details on how to customize your logging configuration. + LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'filters': { + 'require_debug_false': { + '()': 'django.utils.log.RequireDebugFalse' + } + }, + 'handlers': { + 'mail_admins': { + 'level': 'ERROR', + 'filters': ['require_debug_false'], + 'class': 'django.utils.log.AdminEmailHandler' + } + }, + 'loggers': { + 'django.request': { + 'handlers': ['mail_admins'], + 'level': 'ERROR', + 'propagate': True, + }, + } + } + + + # WAGTAIL SETTINGS + + # This is the human-readable name of your Wagtail install + # which welcomes users upon login to the Wagtail admin. + WAGTAIL_SITE_NAME = 'My Project' + + # Override the search results template for wagtailsearch + # WAGTAILSEARCH_RESULTS_TEMPLATE = 'myapp/search_results.html' + # WAGTAILSEARCH_RESULTS_TEMPLATE_AJAX = 'myapp/includes/search_listing.html' + + # Replace the search backend + #WAGTAILSEARCH_BACKENDS = { + # 'default': { + # 'BACKEND': 'wagtail.wagtailsearch.backends.elasticsearch.ElasticSearch', + # 'INDEX': 'myapp' + # } + #} + + # Wagtail email notifications from address + # WAGTAILADMIN_NOTIFICATION_FROM_EMAIL = 'wagtail@myhost.io' + + # If you want to use Embedly for embeds, supply a key + # (this key doesn't work, get your own!) + # EMBEDLY_KEY = '253e433d59dc4d2xa266e9e0de0cb830' + + +urls.py +------- + +.. code-block:: python + + from django.conf.urls import patterns, include, url + from django.conf.urls.static import static + from django.views.generic.base import RedirectView + from django.contrib import admin + from django.conf import settings + import os.path + + from wagtail.wagtailcore import urls as wagtail_urls + from wagtail.wagtailadmin import urls as wagtailadmin_urls + from wagtail.wagtaildocs import urls as wagtaildocs_urls + from wagtail.wagtailsearch.urls import frontend as wagtailsearch_frontend_urls + + admin.autodiscover() + + + # Signal handlers + from wagtail.wagtailsearch import register_signal_handlers as wagtailsearch_register_signal_handlers + wagtailsearch_register_signal_handlers() + + + urlpatterns = patterns('', + url(r'^django-admin/', include(admin.site.urls)), + + url(r'^admin/', include(wagtailadmin_urls)), + url(r'^search/', include(wagtailsearch_frontend_urls)), + url(r'^documents/', include(wagtaildocs_urls)), + + # For anything not caught by a more specific rule above, hand over to + # Wagtail's serving mechanism + url(r'', include(wagtail_urls)), + ) + + + if settings.DEBUG: + from django.contrib.staticfiles.urls import staticfiles_urlpatterns + + urlpatterns += staticfiles_urlpatterns() # tell gunicorn where static files are in dev mode + urlpatterns += static(settings.MEDIA_URL + 'images/', document_root=os.path.join(settings.MEDIA_ROOT, 'images')) + urlpatterns += patterns('', + (r'^favicon\.ico$', RedirectView.as_view(url=settings.STATIC_URL + 'myapp/images/favicon.ico')) + ) + + + diff --git a/docs/wagtail_search.rst b/docs/wagtail_search.rst index 1fa2c6525..6a77b06f3 100644 --- a/docs/wagtail_search.rst +++ b/docs/wagtail_search.rst @@ -1,3 +1,6 @@ + +.. _search: + Search ====== diff --git a/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html b/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html index e7bd88606..8506e9075 100644 --- a/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html +++ b/wagtail/contrib/wagtailstyleguide/templates/wagtailstyleguide/base.html @@ -42,9 +42,10 @@
  • color-teal
  • color-teal-darker
  • color-teal-dark
  • -
  • color-red
  • -
  • color-orange
  • -
  • color-green
  • + + + +
    @@ -149,29 +156,37 @@

    Buttons

    -
    button
    +
    button -
    button-secondary
    + button-secondary -
    yes
    + yes -
    no / serious
    + no / serious -
    bicolor with icon
    + bicolor with icon -
    button-small
    + button-small -
    bicolo button-small
    + bicolo button-small -
    mixed 1
    + mixed 1 -
    mixed 2
    + mixed 2 + +
    button on a div

    Buttons must have interaction possible (i.e be an input or button element) to get a suitable hover cursor

    + + + + + +
    diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/login.html b/wagtail/wagtailadmin/templates/wagtailadmin/login.html index 22682500f..52448ffe5 100644 --- a/wagtail/wagtailadmin/templates/wagtailadmin/login.html +++ b/wagtail/wagtailadmin/templates/wagtailadmin/login.html @@ -28,17 +28,17 @@