| name | build-wagtail-test-site |
|---|---|
| description | Plan and build a Wagtail test project for testing |
| license | MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # convert-to-webp.sh | |
| # Converts PNG/JPG/GIF/TIFF/BMP to WebP. Animated GIFs use gif2webp. Does not delete originals. The .webp versions are written alongside them. | |
| # Skips: favicons, SVG, already-WebP files. | |
| # Replace IMG_DIR file path from your project to use this script for your own stuff. This script should work on Linux as well but will need some modification for Windows. | |
| IMG_DIR="${1:-wagtailio/static/img}" | |
| QUALITY=85 | |
| METHOD=6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #standardSQL | |
| CREATE TEMP FUNCTION toMarkdown( | |
| name STRING, | |
| version STRING, | |
| home_page STRING, | |
| project_urls ARRAY<STRING>) | |
| RETURNS STRING | |
| LANGUAGE js AS """ | |
| // Convert project_urls to map for easy access | |
| const urls = {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import requests | |
| from bs4 import BeautifulSoup | |
| import csv | |
| import time | |
| def scrape_user_links(url): | |
| """ | |
| Scrape all hyperlinks with href starting with /user/ from a PyPI page. | |
| Args: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Now create a `base/blocks.py` file and add the following lines of code to it: | |
| ```python | |
| from wagtail.blocks import ( | |
| CharBlock, | |
| ChoiceBlock, | |
| RichTextBlock, | |
| StreamBlock, | |
| StructBlock, | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This code example was provided by Ed Rivas from Oddbird. You can find him on Github at https://github.com/jerivas/ | |
| # Ed says that jsreverse is a helper he finds useful that exposes Django URLs in JS. You can find that package here: https://pypi.org/project/django-js-reverse/ | |
| # Ed says the websocket settings are optional and only really needed if you have some realtime endpoints | |
| # The most important part, according to Ed, is TemplateView at the bottom, which is a catchall for all requests that don't match the prior URLS and loads the frontend. | |
| urlpatterns = [ | |
| path("admin/", admin.site.urls), |