Code Monkey home page Code Monkey logo

wagtailsvg's People

Contributors

aleksi44 avatar alexbueckig avatar alexdeltax avatar ash-crow avatar bashu avatar ekersten avatar p0lygun avatar vanl avatar vasilty avatar vbabiy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

wagtailsvg's Issues

Use svg images inside a RichTextField

Hello,

Would it be possible to either add a "SVG" button or alter the behavior of the "Image button" in the RichTextField editor bar so that we can include SVG images inside a RichTextField the same way we can include a PNG or JPG ?

Svg chooser block does not allow me to upload svg

I tried to use wagtailsvg inside a streamfield with a SvgChooserBlock, but the block only shows me a modal to search the svgs, but even the search functionality does not work. I am little bit lost with this, so I hope someone can help me.

I am working with the following dependencies.
Django==3.2.16
wagtail==2.15.5
wagtailsvg==0.0.35

In the following image it is the modal that it shows me when I click on the block.
image

SvgChooserBlock doesn't show up preview svg image StreamField.

Hi @Aleksi44 !! I'm trying to implement this awesome package to the application with the following versions:

# requirements.txt
Django>3.1,<3.2
wagtail==2.10.2
wagtail-generic-chooser==0.1.1
# wagtailsvg==0.0.14 CUSTOM FORK

Because of wagtail version (2.10.2), I'm using a fork built-in project of this repository, in order to fix the migrations problems, change 0059_apply_collection_ordering to 0052_pagelogentry in 0001_initial.py migration file.

Everything works perfect until, I try to use SvgChooserBlock.

After integrate and build up the custom fork of wagtailsvg with version 0.0.14, I added the following StreamField to my custom page like that:

svg = StreamField([
        ('svg', SvgChooserBlock()),
    ], blank=True)

Now, the problems comes when I cannot previsualize the image inside block on StreamFieldPanel, it looks like this:
Link image preview

Thank for your support.
Cheers !

Missing migration file for wagtailsvg', '0005_alter_svg_file ?

Today I tried to get up my django app on a server.

When I hit the migrations I see the following error:

curated-app       | Traceback (most recent call last):
curated-app       |   File "/code/manage.py", line 22, in <module>
curated-app       |     main()
curated-app       |   File "/code/manage.py", line 18, in main
curated-app       |     execute_from_command_line(sys.argv)
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
curated-app       |     utility.execute()
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
curated-app       |     self.fetch_command(subcommand).run_from_argv(self.argv)
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 414, in run_from_argv
curated-app       |     self.execute(*args, **cmd_options)
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 460, in execute
curated-app       |     output = self.handle(*args, **options)
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/core/management/base.py", line 98, in wrapped
curated-app       |     res = handle_func(*args, **kwargs)
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 108, in handle
curated-app       |     executor = MigrationExecutor(connection, self.migration_progress_callback)
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/executor.py", line 18, in __init__
curated-app       |     self.loader = MigrationLoader(self.connection)
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/loader.py", line 58, in __init__
curated-app       |     self.build_graph()
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/loader.py", line 276, in build_graph
curated-app       |     self.graph.validate_consistency()
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/graph.py", line 198, in validate_consistency
curated-app       |     [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/graph.py", line 198, in <listcomp>
curated-app       |     [n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
curated-app       |   File "/usr/local/lib/python3.10/site-packages/django/db/migrations/graph.py", line 60, in raise_error
curated-app       |     raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
curated-app       | django.db.migrations.exceptions.NodeNotFoundError: Migration self_hosted_apps.0001_initial dependencies reference nonexistent parent node ('wagtailsvg', '0005_alter_svg_file')

I thought maybe I can find this migration in your repo, but it is missing.

Is this something in my project or something from wagtailsvg?

Odd thing: On my local setup It works but that database is running for a few weeks now.

Support for other storages?

Hi!
Thanks a lot for the package, it's great.

When I tried it it was not working, and then I realized that it was storing the files at a local /svg folder instead of the storage that I have by default, which is s3boto for an s3-like provider I use.

I see your code defining this:

    storage = FileSystemStorage(
        location=settings.MEDIA_ROOT,
        base_url=settings.MEDIA_URL
    )

But to be honest I don't understand django storages well enough as for imagining the next steps to make it compatible.

So I'm sharing it here in case you or someone else can shed some light about how to approach it. Sorry I can't be more useful right now!

Migration wagtailsvg.0001_initial dependencies reference nonexistent parent node ('wagtailcore', '0059_apply_collection_ordering')

Migration wagtailsvg.0001_initial dependencies reference nonexistent parent node ('wagtailcore', '0059_apply_collection_ordering')

Why i have such an issue?
my requirements.txt is:

Django==3.1.4
wagtail==2.10
gunicorn==20.0.4
psycopg2-binary==2.8.1
wagtailfontawesome==1.2.1
wagtailtrans==2.2
django-rosetta==0.9.2
social-auth-app-django==3.1.0
git+git://github.com/byashimov/typus.git#egg=typus
google-api-python-client==1.8.0
google-auth-httplib2==0.0.3
google-auth-oauthlib==0.4.1
djangorestframework-recursive==0.1.2
sentry-sdk==0.7.10
wagtail-headless-preview==0.1.4
wagtailsvg==0.0.7

Question: How to render svg's in a template?

L.S.,

I am looking for a way to implement the use of svg's as an individual element of a model, and not as a streamfield. Is there a a way to do that, or does wagtailsvg only work for streamfields?

To clarify further; when I add an image to a wagtail template I do it like so:
{% image self.header_background_image scale-100 as header_background_img %}
<div class="landing section-landing" style="background-image: url({{ header_background_img.url }});">

The problem is that when I use this approach I get the error:
image tag expected an Image object, got <Svg: Logo>

So my question is basically, what to put in place of the image tag in order to render an svg?

All the best,

MPE

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.