wagtail | A Django content management system focused on flexibility and user experience | Content Management System library

 by   wagtail Python Version: 6.1rc2 License: BSD-3-Clause

kandi X-RAY | wagtail Summary

kandi X-RAY | wagtail Summary

wagtail is a Python library typically used in Telecommunications, Media, Media, Entertainment, Web Site, Content Management System applications. wagtail has no bugs, it has build file available, it has a Permissive License and it has high support. However wagtail has 3 vulnerabilities. You can install using 'pip install wagtail' or download it from GitHub, PyPI.

A Django content management system focused on flexibility and user experience
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              wagtail has a highly active ecosystem.
              It has 14896 star(s) with 3223 fork(s). There are 340 watchers for this library.
              There were 10 major release(s) in the last 12 months.
              There are 858 open issues and 3598 have been closed. On average issues are closed in 65 days. There are 167 open pull requests and 0 closed requests.
              It has a positive sentiment in the developer community.
              The latest version of wagtail is 6.1rc2

            kandi-Quality Quality

              wagtail has 0 bugs and 0 code smells.

            kandi-Security Security

              wagtail has 3 vulnerability issues reported (0 critical, 0 high, 3 medium, 0 low).
              wagtail code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              wagtail is licensed under the BSD-3-Clause License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              wagtail releases are available to install and integrate.
              Deployable package is available in PyPI.
              Build file is available. You can build the component from source.
              Installation instructions, examples and code snippets are available.
              It has 124253 lines of code, 9275 functions and 1875 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed wagtail and discovered the below as its top functions. This is intended to give you an instant insight into wagtail implemented functionality, and help decide if they suit your requirements.
            • Register core features .
            • Register core logging actions .
            • Copy a single page .
            • Parse fields parameter .
            • Returns the root page of the given page .
            • Render external link chooser form .
            • Create an alias .
            • Publish a page revision
            • Update aliases .
            • Send notification notifications to all threads .
            Get all kandi verified functions for this library.

            wagtail Key Features

            No Key Features are available at this moment for wagtail.

            wagtail Examples and Code Snippets

            wagtail 'NoneType' object has no attribute 'model'
            Pythondot img1Lines of Code : 14dot img1License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            class CategoryPage(Page):
                description_meta = models.CharField(max_length=500, null=True, blank=True)
                template = models.CharField(max_length=500, null=True, blank=True, default='_nixaTemplate/category/default.html')
                image = mode
            How to switch wagtail homepage depending on user logged in status
            Pythondot img2Lines of Code : 8dot img2License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            class HomePage(Page):
                # ...
                def get_template(self, request, *args, **kwargs):
                    if request.user.is_authenticated:
                        return "home/home_page.html"
                    else:
                        return "home/not_authenticated.html"
            
            Wagtail add RawHTMLBlock to field in model
            Pythondot img3Lines of Code : 4dot img3License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            code_text = models.TextField(blank=True)
            
            {{ header.code_text|safe }}
            
            How to specify a template for a Snippet in a StreamField when using SnippetChooserBlock
            Pythondot img4Lines of Code : 8dot img4License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            class MyPage(Page):
                body = StreamField([('Snippet', SnippetChooserBlock(
                                    target_model='web.Advert', template='blocks/advert.html')])
            
            
                {{ value.text }}
            
            <
            Wagtailmenus: how to access Page fields from first level menu?
            Pythondot img5Lines of Code : 3dot img5License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            {% for item in menu_items %}
              ... {{ item.link_page.title}} ...
            
            Wagtail 'View live' button provides wrong url after page creation while using id as slug
            Pythondot img6Lines of Code : 25dot img6License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            from django.db.models.signals import post_save
            from django.dispatch import receiver
            
            from .models import PropertyPage
            
            
            @receiver(post_save)
            def set_number_and_slug_after_property_page_created(sender, instance, created, **kwargs):
                if i
            How to get two RichText features to be mutually exclusive
            Pythondot img7Lines of Code : 73dot img7License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            /**
             * Remove all of the COLOR_ styles from the current selection.
             * This is to ensure only one COLOR_ style is applied per range of text.
             * Replicated from https://github.com/thibaudcolas/draftjs-filters/blob/f997416a0c076eb6e850f13addc
            How to override default wagtail slug generation?
            Pythondot img8Lines of Code : 25dot img8License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            from unidecode import unidecode
            from django.template import defaultfilters
            
            
            class HomePage(Page):
                date_published = models.DateField(blank=True, null=True)
                content = .....
            
                def clean(self):
                    super().clean()
                    date 
            How to override default wagtail slug generation?
            Pythondot img9Lines of Code : 8dot img9License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            def some_date_method(self):
                return datetime.datetime.now()
            
            
            def save(self, *args, **kwargs):
                self.slug = f"{slugify(self.title)}-{self.some_date_method()}"
                super().save(*args, **kwargs)
            
            Wagtail - pass parameters to struct block
            Pythondot img10Lines of Code : 6dot img10License : Strong Copyleft (CC BY-SA 4.0)
            copy iconCopy
            def __init__(self, folder=None, **kwargs):
                super().__init__(**kwargs)
                template_block = blocks.ChoiceBlock(choices=get_designs(folder), label=_('Select a template'), required=False)
                template_block.set_name('template')
                self.c

            Community Discussions

            QUESTION

            Snippet title problem after upgrade from wagtail 1.13 to 2.0
            Asked 2022-Apr-11 at 11:13

            I am working on wagtail upgrade on a site from version 1.13.4 . Was mostly following this post https://wagtail.org/blog/upgrading-wagtail/ . However, since the first update to wagtail 2.0 snippet titles are wrong. I could sort it out on the templated front end pages, but they still appear wrong on the admin panel.

            How titles are displayed on the admin panel And this same issue is with fields that link to those snippets

            I got as far as updating wagtail to 2.4, since the blog post said that it should support python 3.7, but issue still persists. As far as I can tell, there are no error messages on the terminal output, migrations run without any issues. Any clue where I should start looking?

            This should be the relevant artist snippet declaration from the project

            ...

            ANSWER

            Answered 2022-Apr-11 at 11:13

            When upgrading from Python 2 to 3, you should replace the __unicode__ method with __str__: https://docs.djangoproject.com/en/1.10/topics/python3/#str-and-unicode-methods

            Source https://stackoverflow.com/questions/71826673

            QUESTION

            dependencies reference nonexistent child node
            Asked 2022-Apr-10 at 15:46

            I tried to dockerize my Wagtail Web Application and this error Occurred. I tried docker-compose build there was no errors. after that i tried docker-compose up then this error occurred I really need help on this error. Error-

            ...

            ANSWER

            Answered 2022-Apr-10 at 15:46

            QUESTION

            Wagtail Admin: How to Add ReadOnlyBlocks to show snippets fields values in a StructBlock
            Asked 2022-Mar-04 at 12:41

            I have a Snippet model(SampleSnippet) with fields field_a, field_b, and field_c. And I am using it in a StructBlock like:

            ...

            ANSWER

            Answered 2022-Mar-04 at 10:42

            This is going to be quite difficult, since in current Wagtail versions (>=2.13) the StreamField editing UI is populated client-side in Javascript - as such, there are some extra steps to make the necessary data available to the client-side code, and the standard Django form / template mechanisms won't be available.

            A simple workaround, if the fields aren't too long, would be to define the snippet's __str__ method to include the desired data - this will then display any time the snippet is shown in the admin.

            For a full solution, I'd suggest this approach:

            • Set up a custom form_template for your StructBlock as detailed in Custom editing interfaces for StructBlock, with placeholder

              elements to contain your additional data.

            • Override the StructBlock's get_form_state so that the returned dict (which will be used to populate the form template on the client side) includes your additional fields - something like:

            Source https://stackoverflow.com/questions/71347329

            QUESTION

            How to switch wagtail homepage depending on user logged in status
            Asked 2022-Mar-03 at 09:36

            I have previously been using path("", include(wagtail_urls)) for my home_page url which displays the template at home/home_page.html correctly

            I wish to however display different pages depending on whether a user is logged in or not so have changed this to:

            ...

            ANSWER

            Answered 2022-Mar-03 at 09:36

            The include(wagtail_urls) pulls in Wagtail's page handling logic for selecting which page should be returned for a given URL. If you swap that line out with your own code, you're effectively swapping out all of Wagtail...

            First, consider whether you're reinventing the page privacy feature that Wagtail already provides. If you want the site as a whole to require a login, and non-logged-in users to be given a blanket generic login form, you can enable this using the Privacy control under the Settings tab (or in the top right corner on older Wagtail releases) when editing the homepage, and set WAGTAIL_FRONTEND_LOGIN_TEMPLATE = "home/not_authenticated.html" in your project settings file.

            If you just want to swap the template for the homepage specifically, you can do that by defining a get_template method on your HomePage model:

            Source https://stackoverflow.com/questions/71332514

            QUESTION

            Adding external javascript snippet to a Wagtail page field
            Asked 2022-Feb-28 at 22:44

            My current Wagtail project has a very simple structure with some generic pages that have just a body RichTextField. These are just basic CMS type pages where an editor will edit some content in the rich text editor and publish.

            One of the pages (and probably more in time) is a "Help Wanted" page and uses an external javascript snippet from a third-party service that lists current job openings with links to the applications that are hosted by them.

            Since adding a

            ...

            ANSWER

            Answered 2022-Feb-28 at 22:44

            This is a result of the Django template language's auto-escaping behaviour, and can be overridden by adding a |safe filter:

            Source https://stackoverflow.com/questions/71301680

            QUESTION

            Changing Template Location in Wagtail
            Asked 2022-Jan-29 at 18:23

            I'm trying to direct wagtail to use a template in a centralised location at the top of the project tree. So for example:

            ...

            ANSWER

            Answered 2022-Jan-29 at 18:23

            Below is how I organize templates and static assets. I have a themes folder that is located in the main project folder with named theme subfolders within the themes folder. I then have the following in settings/base.py:

            Source https://stackoverflow.com/questions/70774070

            QUESTION

            Wagtail 'View live' button provides wrong url after page creation while using id as slug
            Asked 2022-Jan-26 at 14:39

            I have a case that uses Page ID as a slug, after creating a new Page, Wagtail provides us a "View live" button but when we click on that button, it provides a wrong URL

            The right URL should be ".../property-list/"

            I have searched on stack overflow, found this thread but the answer is still a mystery: Wrong 'View live' url in Wagtail admin message after page creation when using id as slug

            I have followed the Wagtail official document, using Wagtail Hooks to manipulate data. However, no success yet. This is my code:

            ...

            ANSWER

            Answered 2022-Jan-26 at 14:39

            The after_create_page hook doesn't work for this, as it's one of the last things to run during the Wagtail admin's page creation view, and the confirmation message (including the old URL) has already been constructed by that point. This can be remedied by using the post_save signal provided by Django instead - being a more low-level mechanism, it's more closely tied to the act of saving the database record, without Wagtail's admin logic getting in the way.

            (It's also a bit more future-proof: Wagtail's after_create_page hook is designed to only be called when a user goes through the page creation area of the Wagtail admin, so that it can be used to customise that user's path through the admin if appropriate. If there's ever any other route by which a page might be created - like, say, a data import, or using translation tools for a multi-language site - then after_create_page will be bypassed, but the post_save signal will still be triggered.)

            Assuming your project has a properties app where you're defining a PropertyPage model, your code can be rewritten to use post_save as follows - in properties/signals.py:

            Source https://stackoverflow.com/questions/70515946

            QUESTION

            Testing a Wagtail StructBlock with a StreamBlockField
            Asked 2021-Dec-29 at 15:02

            I'm attempting to run some unit tests on a StructBlock, which is composed of normal block fields and a StreamBlock.

            The problem I'm running into is that I can construct a test that renders the block, but I cannot test the StreamBlock validation (i.e., I can't test the block's clean())

            Stack

            • Python 3.9.6
            • Django 3.2
            • Wagtail 2.13
            • pytest 6.2
            • pytest-django 4.4

            Block Definitions

            MyStructBlock

            ...

            ANSWER

            Answered 2021-Dec-29 at 15:02

            Every block type has a corresponding 'native' data type for the data it expects to work with - for the simpler blocks, this data type is what you'd expect (e.g. a string for CharBlock, an Image instance for ImageChooserBlock) but for a few of the more complex ones, there's a custom type defined:

            • for RichTextBlock, the native type is wagtail.core.rich_text.RichText (which behaves similarly to a string, but also has a source property where e.g. page IDs in page links are kept intact)
            • for StreamBlock, the native type is wagtail.core.blocks.StreamValue (a sequence type, where each item is a StreamValue with block_type and value properties).

            The render method will generally be quite forgiving if you use the wrong types (such as a string for RichTextBlock or a list of dicts for StreamBlock), since it's really just invoking your own template code. The clean method will be more picky, since it's running Python logic specific to each block.

            Unfortunately the correct types to use for each block aren't really formally documented, and some of them are quite fiddly to construct (e.g. a StructValue needs to be passed a reference to the corresponding StructBlock) - outside of test code, there isn't much need to create these objects from scratch, because the data will usually be coming from some outside source instead (e.g. a form submission or the database), and each block will be responsible for converting that to its native type.

            With that in mind, I'd recommend that you construct your data by piggybacking on the to_python method, which converts the JSON representation as stored in the database (consisting of just simple Python data types - integers, strings, lists, dicts) into the native data types:

            Source https://stackoverflow.com/questions/70520041

            QUESTION

            How to customize the admin form for a custom image model in Wagtail CMS?
            Asked 2021-Dec-02 at 16:45

            I need to add a string based unique ID to Wagtail’s image model. These IDs are a relatively short combination of letters, numbers and punctuation, e.g. "AS.M-1.001". So I am using a custom image model with Django’s standard CharField for that with the argument unique=True. But the editing form unfortunately does not check if the ID is unique. So I can use the same ID for multiple images. This check for uniqueness does work in any other standard form in Wagtail, e.g. the Page model. But not for the image model.

            ...

            ANSWER

            Answered 2021-Dec-02 at 14:36

            Images in Wagtail don't use WagtailAdminModelForm or the base_form_class attribute - these are used by pages, snippets and ModelAdmin to support Wagtail-specific features like inline children and panels, but images work through plain Django models and forms.

            You can customise the form by subclassing BaseImageForm and setting WAGTAILIMAGES_IMAGE_FORM_BASE in your project settings. As long as you define your form class somewhere outside of models.py (e.g. in a separate forms.py module), you'll avoid the circular dependency that leads to the "Models aren't loaded yet" error.

            Source https://stackoverflow.com/questions/70200660

            QUESTION

            Why won't a Wagtail TableBlock Display Properly in the Admin?
            Asked 2021-Nov-05 at 01:53

            I'd like to have a TableBlock display in my admin panel, but it isn't displaying properly.

            Here are the errors I'm getting:

            And here's the code block:

            ...

            ANSWER

            Answered 2021-Nov-03 at 17:36

            The errors in the browser console show that the Javascript files included in the wagtail.contrib.table_block app are not loading. Most likely, these are missing from your S3 file hosting (S3 returns 403 Forbidden for missing files).

            After adding wagtail.contrib.table_block to INSTALLED_APPS and deploying to your server, you'll need to re-run ./manage.py collectstatic to ensure these JS files are uploaded to S3.

            Source https://stackoverflow.com/questions/69828781

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install wagtail

            Wagtail works with Python 3, on any platform.

            Support

            docs.wagtail.org is the full reference for Wagtail, and includes guides for developers, designers and editors, alongside release notes and our roadmap.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
          • PyPI

            pip install wagtail

          • CLONE
          • HTTPS

            https://github.com/wagtail/wagtail.git

          • CLI

            gh repo clone wagtail/wagtail

          • sshUrl

            git@github.com:wagtail/wagtail.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Reuse Pre-built Kits with wagtail

            Consider Popular Content Management System Libraries

            Try Top Libraries by wagtail

            bakerydemo

            by wagtailPython

            django-modelcluster

            by wagtailPython

            wagtaildemo

            by wagtailPython

            Willow

            by wagtailPython

            wagtail-localize

            by wagtailPython