Giter Site home page Giter Site logo

wagtail-heroicons's People

Contributors

joshuadavidthomas avatar reijerboodt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

reijerboodt

wagtail-heroicons's Issues

"TypeError: '<' not supported between instances of 'PosixPath' and 'str'" whenever using wagtail_heroicons

Adding "wagtail_heroicons" to INSTALLED_APPS gives the following error (on the latest version of Wagtail, on linux)

  File "/home/reijer/.pyenv/versions/clean-test/lib/python3.10/site-packages/wagtail/admin/views/home.py", line 388, in sprite
    return HttpResponse(icons())
  File "/home/reijer/.pyenv/versions/clean-test/lib/python3.10/site-packages/wagtail/admin/views/home.py", line 368, in icons
    all_icons = sorted(
TypeError: '<' not supported between instances of 'PosixPath' and 'str'

Steps to reproduce

  • Create clean python virtual environment. (I used Python 3.10.11)
  • Install wagtail pip install wagtail
  • Create empty project wagtail start mysite
  • In mysite, run migrations.
  • Add "wagtail_heroicons" to INSTALLED_APPS
  • python manage.py runserver gives the above error.

Changing line 14 of src/wagtail_heroicons/wagtail_hooks.py to read icons.append(str(icon.path)) instead of icons.append(icon.path) fixes the issue.

Explore writing a custom Template loader to load from zip file

Related to #28, in the heroicon package the icons are actually stored in a zip file to save space. This poses a problem for how Wagtail deals with SVG icons, as it expects the SVG to be a template somewhere where a template loader can find it.

As far as I can tell, Django does not come with a way to load templates from a zip. We may need to write a custom one, utilizing heroicons._load_icon or heroicons._render_icon in some way.

https://docs.djangoproject.com/en/4.1/ref/templates/api/#custom-loaders

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.