Saravanan666/pypi-org huggingface dataset:
Package: wagtail-trash
wagtail trashInstead of deleting pages when pressing delete, pages will get thrown into the "Trash Can".InstallFirst install the python package:pip install wagtail-trashThis step will install bothwagtail-trashandwagtail-modeladminwhich is a requirement for the admin.Then add bothwagtail-trashandwagtail-modeladminto yourINSTALLED_APPS:INSTALLED_APPS=[# ..."wagtail_modeladmin","wagtail_trash",]Run migrations, et voila!How it worksWagtail Trash works by hooking into the Wagtail hookbefore_delete_pageand overriding the delete view.
Instead of deleting the page the page gets moved to the special "Trash" page. The deleted page and all descendants will get unpublished.
From the trash can in Wagtail admin it's then possible to permanently delete the page or to restore the page. Restoring a page will also republish the pages that were published when getting deleted.
If the parent of the deleted page is either in the trash can or permanently deleted it's still possible to restore the pages by supplying an alternate parent.CaveatsSince Wagtail Trash uses the hookbefore_delete_pageit might interfere with your applicationsbefore_delete_pageif you have defined one that returns a status code. Make sure wagtail trash is the last hook that runs otherwise or your custombefore_delete_pagemight not run since Wagtail Trash doesn't call it.Also, Wagtail Trash "deletes" pages by unpublishing them, so if you use a queryset that doesn't filter out unpublished pages, pages in trash can might show up. There is a manager that will fix this for you included, example:fromwagtail.core.modelsimportPage,PageManagerfromwagtail_trash.managersimportTrashManagerclassSomePage(Page):objects=PageManager()# needed, so _default_manager isn't the trash managerobjects_excluding_trash=TrashManager()# Now you can do this without getting any pages from the bin:SomePage.objects_excluding_trash.all()Permissions: If you remove a page under a restricted area, this page will be moved and therefore get new permissions. A user might go from not being allowed to see pages under e.g. "Secret Page", but when a page under this area is moved to trash can, the permissions from "Secret Page" are gone so now the user will see it in the trash can.
This is a solvable issue and will be fixed in a later version.Clearing the bin regularlyThere is an included managment-command calledempty_trashthat takes a required argument--older_than_days. To remove all items in the bin that's been there more than 30 days run this command:./manage.py empty_trash --older_than_days=30Git flowThis project uses git flow, current release is in themainbranch and the current development is in thedevelopbranch.Licensewagtail trash is released under theMIT License.
Package: wagtail-treemodeladmin
Wagtail-TreeModelAdminWagtail-TreeModelAdmin is an extension for Wagtail'swagtail-modeladminthat allows for a page explorer-like navigation of Django model relationships within the Wagtail admin.DependenciesInstallationConceptsUsageQuickstartAPIGetting helpGetting involvedLicensingCredits and referencesDependenciesPython 3.8+Django 3.2 (LTS), 4.1 (current)Wagtail 5.1+wagtail-modeladminIt should be compatible with all intermediate versions, as well.
If you find that it is not, pleasefile an issue.InstallationInstall wagtail-treemodeladmin:pipinstallwagtail-treemodeladminAddtreemodeladmin(andwagtail_modeladminif it's not already) as an installed app in your Djangosettings.py:INSTALLED_APPS=(...'wagtail_modeladmin','treemodeladmin',...)ConceptsWagtail-TreeModelAdmin allows for a Wagtail page explorer-like navigation of Django one-to-many relationships within the Wagtail admin. In doing this, it conceptualizes the DjangoForeignKeyrelationship as one of parents-to-children. The parent is the destinationtoof theForeignKeyrelationship, the child is the source of the relationship.Wagtail-TreeModelAdmin is an extension ofwagtail-modeladmin. It is intended to be used exactly likeModelAdmin.UsageQuickstartTo use Wagtail-TreeModelAdmin you first need to define some models that will be exposed in the Wagtail Admin.# libraryapp/models.pyfromdjango.dbimportmodelsclassAuthor(models.Model):name=models.CharField(max_length=255)classBook(models.Model):author=models.ForeignKey(Author,on_delete=models.PROTECT)title=models.CharField(max_length=255)Then create theTreeModelAdminsubclasses and register the root the tree usingmodeladmin_register:# libraryapp/wagtail_hooks.pyfromwagtail_modeladmin.optionsimportmodeladmin_registerfromtreemodeladmin.optionsimportTreeModelAdminfromlibraryapp.modelsimportAuthor,BookclassBookModelAdmin(TreeModelAdmin):model=Bookparent_field='author'@modeladmin_registerclassAuthorModelAdmin(TreeModelAdmin):menu_label='Library'menu_icon='list-ul'model=Authorchild_field='book_set'child_model_admin=BookModelAdminThen visit the Wagtail admin.Librarywill be in the menu, and will give you a list of authors, and each author will have a link that will take you to their books.APIWagtail-TreeModelAdmin uses three new attributes on ModelAdmin subclasses to express parent/child relationships:parent_field: The name of the DjangoForeignKeyon a child model.child_field: Therelated_nameon a DjangoForeignKey.child_model_adminAnyTreeModelAdminsubclass can specify both parent and child relationships. The root of the tree (either theTreeModelAdminincluded in aModelAdminGroupor the@modeladmin_registeredTreeModelAdminsubclass) should only includechild_*fields.Getting helpPlease add issues to theissue tracker.Getting involvedGeneral instructions onhowto contribute can be found inCONTRIBUTING.LicensingTERMSLICENSECFPB Source Code PolicyCredits and referencesForked fromcfgov-refresh
Package: wagtailtwbsicons
wagtailtwbsiconsA wagtail package to addTwitter's Bootstrap Iconsto administration icons list.Currently using Bootstrap Icons v1.11.3, works with Wagtail > 3 (use 1.0.0 for older wagtail versions)Installpip install wagtailtwbsiconsUsageAdd wagtailtwbsicons to INSTALLED_APPS in your project settingsINSTALLED_APPS = [
    ...
    'wagtailtwbsicons',
    ...     
]Have a look tothe available list of iconsand use the last class provided for web font inthe regular Wagtail way(ex: forperson-square icon, the website provide to use "bi bi-person-square" class, so we need to use "bi-person-square")class PersonBlock(blocks.StructBlock):
    first_name = blocks.CharBlock()
    ...
    class Meta:
        icon = 'bi-person-square'Using wagtailtwbsicons as an optionnal dependencyfrom django.apps import apps

class PersonBlock(blocks.StructBlock):
    first_name = blocks.CharBlock()
    ...
    class Meta:
        if apps.is_installed('wagtailtwbsicons'):
            icon = 'bi-person-square'
Package: wagtail-typograf
A plugin to addtypusfunctionality to wagtail rich text editor (draftail).DemoInstallationInstall with pippip install wagtail-typografAdd app name to your list of installed appsINSTALLED_APPS = [
    ...
    "wagtail_typograf",
]Add typograf url to your urlpatterns (for now “/api/typograf/” is strongly hardcoded in js)urlpatterns = [
  ...
  path('api/', include('wagtail_typograf.urls')),
  ...
]If you use limit number of features in RichTextBlock, don’t forget to addtypografto its listtext_block = RichTextBlock(
    features=[
        "bold", "italic", "ol", "ul", "hr",
        "link", "document-link", "typograf",
    ],
    ...
)UsageWrite or paste text content, push the ¶-button.
Package: wagtail-uikitblocks
Wagtail UIKit BlocksA collection ofUIKitcomponents that can be used as a Wagtail StreamField block.Available UIKit componentsContainerGridHeadingImageSlideshowSliderLightboxModal PopupSwitcherBannerButtonLinkSome components also have alignment, margin, padding, and animation properties as well.Quick startInstall from PyPIpip install wagtail-uikitblocksAdd "uikitblocks" to your INSTALLED_APPSINSTALLED_APPS = [
    ...
    'uikitblocks',
]In your models.py, import the uikitblocks modulefrom uikitblocks import blocksThe root component - which contains all the available components, is a grid (uk-grid) component, which can be used as a StreamField.grid = StreamField(
      [("UIKit", blocks.UIKitGrid())], blank=True, null=True
  )Instead of adding the whole grid component, you can also add individual UIKit components to your model class as well. An example is given below.heading = StreamField(
  [("heading", blocks.HeadingBlock())], blank=True, null=True
  )Runpython manage.py migrateto migrate the model changes.The UIKit library must be imported in order to display the changes. You can either do it manually (For more info, please see the UIKit's official documentationhere) or you can load the production ready files via the template tag.Add the following in the base template.{% load uikit_assets %}Before closing the head tag, load css and js files by adding the following template tags.{% uikit_css %}
{% uikit_js %}Optional configurationThe number of children appear inside a grid can be altered.For example, if you want to display 4 children in extra large (above 1600px) screens, 3 children in large (above 1200px) screens, and 2 children in medium (above 960px) screens, add the following lines in your settings module.Please note that only 1-6 are valid by default.UIKIT_GRID_CHILDREN_COUNT_EXTRA_LARGE = 4
UIKIT_GRID_CHILDREN_COUNT_LARGE = 3
UIKIT_GRID_CHILDREN_COUNT_MEDIUM = 2Demo
Package: wagtail-unsplash
Wagtail UnsplashSearch for Unsplash images and upload to the Wagtail image library.This package uses thepython-unsplashAPI wrapper:SetupInstall using pip:pipinstallwagtail-unsplashAfter installing the package, addwagtail_unsplashto installed apps in your settings file:# settings.pyINSTALLED_APPS=[...'wagtail_unsplash',...]and add the API credentials:# settings.pyWAGTAIL_UNSPLASH={"CLIENT_ID":"","CLIENT_SECRET":""}You can get the needed information by creating an application athttps://unsplash.com/developers
Package: wagtail-user-workspace
Wagtail User WorkspaceThis app creates personal workspace page for every user on registration.Users are able to publish new child pages under their workspace page. This includes minimal needed permissions to do so. Namely access to Wagtail admin and add, edit and publish permissions to their own workspace page.Structure and type of these pages is highly customisable.Quick startInstall "wagtail-user-workspace" using pip$ pip install wagtail-user-workspaceAdd "wagtail_user_workspace" to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
    ...,
    "wagtail_user_workspace",
]Define model for root page that will contain all of the user workspace pages:from wagtail.models import Page
from wagtail_user_workspace.models import WorkspacePageBase    

# This page will be used as a root for each users workspace
class CustomWebPage(Page):
    ...        

# This page serves as a root page for all the workspace pages
# Type of these pages is determined by page model defined in subpage_types
class UserWorkspacesRootPage(WorkspacePageBase, Page):
    ...
    subpage_types = [
        'your_app.CustomWebPage',
    ]
    ...Valid workspaces root page rules:Page models that subclassWorkspacePageBasealso has to subclasswagtail.models.Page. Any other model that subclasseswagtail.models.Pagecan do as well.Subclasses ofWorkspacePageBasehas to have exactly one page model defined insubpage_types. This also has to be a subclass ofwagtail.models.Page.Configure workspace page model:USER_WORKSPACE_PAGE_MODEL = "your_app.UserWorkspacesRootPage"Make and apply database migrations with new changes:$ python manage.py makemigrations
$ python manage.py migrateNow start your web, navigate to the Wagtail admin interface and create root page for user workspaces:After some user signs in, new workspace page will be generated for him.
User has a full controll over this page. He can edit, publish, and even delete it. If defenition ofCustomWebPagealows it, he can even add subpages.DevelopmentTo develop this app locally you can just clone this repo. Then run local server by running$ python manage.py runserveror when using VSCode just hit F5 or another Run key. VSCode will use settings fromlaunch.jsonThen you can start developing this app!TestingYou can run tests like that:$ python manage.py test
Package: wagtail-utphy-richdocument
This is a wagtail app to be applied on wagtail generic docs.
It adds the following streamfield blocks:doc_bylinebody_textquotebustoutcode_chunkmath_formulatablemedia_embedDependencieswagtailQuick Startinstall from pypy:pip install wagtail-utphy-richdocumentadd “utphy_richdocument” and “wagtail.contrib.table_block” to your INSTALLED_APPS setting:INSTALLED_APPS = [
    ...
    'wagtail.contrib.table_block',
    'utphy_richdocument',
]In your own app create a new model which subclasses the StreamFieldDoc model.models.py:from utphy_richdocument.models import StreamFieldDoc
from wagtail.wagtailadmin.edit_handlers import StreamFieldPanel

class YourModel(StreamFieldDoc):
    template = 'path_to_your_template.html'

    content_panels = Page.content_panels + [
        # your_model_fields
        StreamFieldPanel('body'),
]In your template, make sure you have the following snippet:path_to_your_template.py:{% for block in self.body %}
  {{block}}
{% endfor %}Finally run:python manage.py collectstatic
python manage.py makemigrations
python manage.py migrate
Package: wagtailversesblock
Wagtail Verses BlockBible verse highlighter/formatter streamfield block for Wagtail CMS.UsageImport and addVersesBlocktomodels.py:...fromwagtail.core.modelsimportPagefromwagtail.core.fieldsimportStreamFieldfromwagtailversesblock.blocksimportVersesBlock...classExamplePage(Page):...body=StreamField([('verses',VersesBlock()),],null=True)DevelopmentPull requests and/or feature suggestions are welcome!LicenseLicensed under the BSD 3-Clause license
Package: wagtail-videos
Based on wagtailimages. The aim was to have feature parity with images
but for html5 videos. Includes the ability to transcode videos to a
html5 compliant codec using ffmpeg.RequirementsWagtail >= 2.0ffmpegInstallingInstall using pypipipinstallwagtail-videosUsingOn a page model:Implement as aForeignKeyrelation, same as wagtailimages.fromdjango.dbimportmodelsfromwagtail.wagtailadmin.edit_handlersimportFieldPanelfromwagtail.wagtailcore.fieldsimportRichTextFieldfromwagtail.wagtailcore.modelsimportPagefromwagtailvideos.edit_handlersimportVideoChooserPanelclassHomePage(Page):body=RichtextField()header_video=models.ForeignKey('wagtailvideos.Video',related_name='+',null=True,on_delete=models.SET_NULL)content_panels=Page.content_panels+[FieldPanel('body'),VideoChooserPanel('header_video'),]In template:The video template tag takes one required postitional argument, a video
field. All extra attributes are added to the surrounding<video>tag. The original video and all extra transcodes are added as<source>tags.{%loadwagtailvideos_tags%}{%videoself.header_videoautoplaycontrolswidth=256%}How to transcode using ffmpeg:Using the video collection manager from the left hand menu. In the video
editing section you can see the available transcodes and a form that can
be used to create new transcodes. It is assumed that your compiled
version of ffmpeg has the matching codec libraries required for the
transcode.Future featuresRichtext embedStreamfield blockTranscoding via amazon service rather than ffmpegWagtail homescreen video count
Package: wagtail-word
wagtail_wordA Wagtail module to display Word documents in the frontend.
Converts your word documents to richtext for easy editing in the Wagtail admin.Currently supported filetypes:.docx.docCurrently supported content:Text (Bold, underlines, italic, strikethrough)Text suports colors with allow_styling=TrueColors get reset after saving the page in Wagtail admin for a second time.ImagesTablesHyperlinksListsAll will be converted to bullet pointsSingle level lists onlyQuick startAdd 'wagtail_word' to your INSTALLED_APPS setting like this:INSTALLED_APPS = [
...,
'wagtail_word',
]Simply go to your Wagtail Admin.Create a new Word Page.Upload a file in the File field.Save or publish the page and see the magic!Base ClassWe provide a base class to extend from. This class will provide you a predefined FieldPanel for the File, has the allow_styling attribute and a custom method to set the content to the right field for you to override.# Example classclassWordDocumentPage(BaseWordDocumentPage):template='wagtail_word/page.html'content=RichTextField(blank=True,null=True,features=[# Minimal required features for richtext"h1","h2","h3","h4","h5","h6","bold","italic","ol","ul","link""image","embed","blockquote",])edit_panels=[FieldPanel('content'),]edit_handler=TabbedInterface([ObjectList(BaseWordDocumentPage.content_panels,heading=_('Upload')),ObjectList(edit_panels,heading=_('Edit')),...])# Override this method to set the content to the right fielddefset_content(self,content:str):self.content=content
Package: wagtail-wordpress-import
Wagtail WordPress ImportA package for Wagtail CMS to import WordPress blog content from an XML file into Wagtail.RequirementsWagtail CMS Installed following theinitial setupWordPress XML export of all content in a single fileThe WordPress website will need to be live and available for importing of assets such as images and documents.CompatibilityThe package has been developed and tested with:Wagtail: from 2.14 to 2.16Django: 3.1 and 3.2Postgres and SQLite DatabasesModule documentationInitial SetupBlock BuilderCategories ImportImport HooksPrefiltersWordPress Block ShortcodesWordPress Inline ShortcodesYoast Import
Package: wagtail-xliff-translation
wagtail-xliff-translationWagtail XLIFF Translationis a Wagtail library for converting a Wagtail website to XLIFF (XML Localization Interchange File Format) and back.
It allows translators to work with -XLIFF based- translation software.Exporting and importing a sub-tree, or a single page is supported.ExplanationAfter successfully adding this package, new routes will be available (e.g. /admin/pages/<page_id>/xliff/download) and pages will have two extra buttons:Pressing the download button will open the following page, where you can generate and download the XLIFF file:This will generate an XLIFF file in the following format (page used only has a title):<?xml version="1.0" encoding="utf-8"?><xliffsrcLang="en-us"trgLang="fr"version="2.0"xmlns="urn:oasis:names:tc:xliff:document:2.0"xmlns:mda="urn:oasis:names:tc:xliff:metadata:2.0"xmlns:slr="urn:oasis:names:tc:xliff:sizerestriction:2.0"><fileid="4_test_app_pagewithrichtext"><mda:metadata><mda:metaGroupcategory="object_nesting"><mda:metatype="child">no</mda:meta></mda:metaGroup></mda:metadata><unitcanResegment="no"id="title"name="title"slr:sizeRestriction="255"translate="yes"type="local:CharField"><segment><source>Asimplepage</source><target></target></segment></unit><unitcanResegment="no"id="slug"name="slug"slr:sizeRestriction="255"translate="yes"type="local:SlugField"><segment><source>a-simple-page</source><target></target></segment></unit></file></xliff>Note: the source tags contain the content of the original page, the target tags is where the translations go.Finally, this package provides an upload page with several options:Uploading can result in errors, for example when the XLIFF file is missing content in the target tags. Wagtail page validation is also done and can also result in errors.EditorsThe XLIFF file is formatted in such a way it works with XLIFF editors as well, for examplePoedit.Documentationhttps://fourdigits.github.io/wagtail-xliff-translation/Powered by Four DigitsWe love code:https://fourdigits.nl/en/
Package: wagtailyoast
Yoastseo+Wagtail= 🚀Tested with :django==3.0.9wagtail==2.10.1yoastseo:1.80.0SetupInstall with pip :pip install wagtailyoastAdd wagtailyoast to django apps installed :INSTALLED_APPS = [
    ...
    'wagtailyoast',
]Add locale used for Yoast and make sure you have STATIC_URL set up in yoursettings.py:WY_LOCALE = 'en_US'
STATIC_URL = '/static/'Add YoastPannel to your Page models :from wagtail.admin.edit_handlers import TabbedInterface, ObjectList
from wagtailyoast.edit_handlers import YoastPanel


class TestPage(Page):
    ...
    keywords = models.CharField(default='', blank=True, max_length=100)

    edit_handler = TabbedInterface([
        ObjectList(Page.content_panels, heading=('Content')),
        ObjectList(Page.promote_panels, heading=('Promotion')),
        ObjectList(Page.settings_panels, heading=('Settings')),
        YoastPanel(
            keywords='keywords',
            title='seo_title',
            search_description='search_description',
            slug='slug'
        ),
    ])YoastPanelparams are :keywords: Default keywords of the page.title: ‘Search Engine Friendly’ title. This will appear at the top of the browser window.search_description: ‘Search Engine Friendly’ description.slug: URL of the page.Development envgit clone git@github.com:Aleksi44/wagtailyoast.git
pip install -r requirements.txtRun Django Serverpython manage.py migrate
python manage.py init
python manage.py runserver 0.0.0.0:4243Run Webpack Serveryarn
yarn start
Package: wagyu
wagyuIn what followspythonis an alias
forpython3.5orpypy3.5or any later version
(python3.6,pypy3.6and so on).InstallationInstall the latestpip&setuptoolspackages versions:python-mpipinstall--upgradepipsetuptoolsUserDownload and install the latest stable version fromPyPIrepository:python-mpipinstall--upgradewagyuDeveloperDownload the latest version fromGitHubrepositorygitclonehttps://github.com/lycantropos/wagyu.gitcdwagyuInstall setup dependencies:python-mpipinstall--force-reinstall-rrequirements-setup.txtInstall:pythonsetup.pyinstallUsage>>>fromwagyu.enumsimportPolygonKind>>>fromwagyu.linear_ringimportLinearRing>>>fromwagyu.pointimportPoint>>>fromwagyu.polygonimportMultipolygon,Polygon>>>fromwagyu.wagyuimportWagyu>>>lower_triangle=Polygon([LinearRing([Point(0,0),Point(6,0),Point(3,3),Point(0,0)])])>>>upper_triangle=Polygon([LinearRing([Point(3,1),Point(6,4),Point(0,4),Point(3,1)])])>>>wagyu=Wagyu()>>>wagyu.add_polygon(lower_triangle,PolygonKind.SUBJECT)True>>>wagyu.add_polygon(upper_triangle,PolygonKind.CLIP)True>>>(wagyu.intersect()...==Multipolygon([Polygon([LinearRing([Point(3,1),Point(4,2),Point(3,3),Point(2,2),Point(3,1)])])]))True>>>(wagyu.unite()...==Multipolygon([Polygon([LinearRing([Point(6,0),Point(4,2),Point(6,4),Point(0,4),Point(2,2),Point(0,0),Point(6,0)])])]))True>>>(wagyu.symmetric_subtract()...==Multipolygon([Polygon([LinearRing([Point(4,2),Point(3,1),Point(2,2),Point(0,0),Point(6,0),Point(4,2)])]),...Polygon([LinearRing([Point(4,2),Point(6,4),Point(0,4),Point(2,2),Point(3,3),Point(4,2)])])]))True>>>(wagyu.subtract()...==Multipolygon([Polygon([LinearRing([Point(6,0),Point(4,2),Point(3,1),Point(2,2),Point(0,0),Point(6,0)])])]))TrueforCPythonoriginal C++ implementation can be invoked by importing from_wagyumodule instead.DevelopmentBumping versionPreparationInstallbump2version.Pre-releaseChoose which version number category to bump followingsemver
specification.Test bumping versionbump2version--dry-run--verbose$CATEGORYwhere$CATEGORYis the target version number category name, possible
values arepatch/minor/major.Bump versionbump2version--verbose$CATEGORYThis will set version tomajor.minor.patch-alpha.ReleaseTest bumping versionbump2version--dry-run--verbosereleaseBump versionbump2version--verbosereleaseThis will set version tomajor.minor.patch.Running testsInstall dependencies:python-mpipinstall--force-reinstall-rrequirements-tests.txtPlainpytestInsideDockercontainer:withCPythondocker-compose--filedocker-compose.cpython.ymlupwithPyPydocker-compose--filedocker-compose.pypy.ymlupBashscript (e.g. can be used inGithooks):withCPython./run-tests.shor./run-tests.shcpythonwithPyPy./run-tests.shpypyPowerShellscript (e.g. can be used inGithooks):withCPython.\run-tests.ps1or.\run-tests.ps1cpythonwithPyPy.\run-tests.ps1pypy