Coder Social home page Coder Social logo

django-json-ld's People

Contributors

denisroldan avatar dependabot[bot] avatar dmarcelino avatar gassan avatar hiimdoublej avatar thanos 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

Watchers

 avatar

django-json-ld's Issues

Call get_structured_data() after get_queryset()

Hi,

I need queryset from get_queryset to construct the structured data.

The current implementation calls first get_structured_data() then get_queryset(). Is there a way to change this behavior.

One option would be to include get_structured_data's logic in get_queryset().

Kind regards,

H.KIZIL

RemovedInDjango40Warning: force_text() is deprecated in favor of force_str()

If you try to use this library on a project with Django>=4.0, and InvalidTemplateLibrary get raised because of this deprecation.

django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'django_json_ld.templatetags.json_ld': cannot import name 'force_text' from 'django.utils.encoding'

From Django 3.0, the above deprecation warning was added:

The smart_text() and force_text() aliases (since Django 2.0) of smart_str() and force_str() are deprecated. Ignore this deprecation if your code supports Python 2 as the behavior of smart_str() and force_str() is different there.

Now Python 2 ended its life cycle and those were just aliases from Django 2.0, it's safe to change that import.

I'll submit another PR soon.

Default empty json-ld

Hello again @hiimdoublej,

Currently when, for example, I use {% render_json_ld sd %} in base.html and sd is empty or non-existant, django will render:

<script type="application/ld+json">""</script>

Lets call that option A.

I'm wondering if that's the best default behaviour or if we should do something else. Two alternative ideas come to mind:

B. Output nothing, so no script tags are printed.

C. Output a schema.org Thing with the current page URL, something like:

<script type="application/ld+json">
{
   "@context":"https://schema.org"
   "@type":"Thing",
   "url":"http://example.org/",
}
</script>

We can also make this behaviour user configurable.

What are your thoughts?

AttributeError: module 'collections' has no attribute 'Mapping'

Currently this library is not Python 3.10 compatible. This is due to the existing import on utils.py:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working

I'll submit a PR soon fixing this.

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.