Coder Social home page Coder Social logo

Comments (6)

bennylope avatar bennylope commented on May 31, 2024

That would be my guess, but I suspect that the caching strategy employed here (assuming one value for one key) could pose a problem.

I considered whether keys should allow template formatting, this would allow the request language to be passed for the key. Might still do this, but another way of doing this would be to render a template variable for the key, using the request language, and pass that (either from the view, a context processor, or even a template tag of your own devising).

from django-addendum.

Visgean avatar Visgean commented on May 31, 2024

From my experience the easiest way to avoid caching is using lambdas... Anyway I am gonna try to implement this in about a month...

from django-addendum.

bennylope avatar bennylope commented on May 31, 2024

Can you explain what you mean about using lambdas to avoid caching?

from django-addendum.

Visgean avatar Visgean commented on May 31, 2024

Well consider this example:

    'items': Model.objects.filter(), 

versus

   'items': lambda: Model.objects.filter(),

the second one does not get cached, not sure it is the best way but it worked. . Or something like https://docs.djangoproject.com/en/dev/topics/cache/#template-fragment-caching

from django-addendum.

chogarcia avatar chogarcia commented on May 31, 2024

would be awesome if we can integrate translations with this!

from django-addendum.

bennylope avatar bennylope commented on May 31, 2024

This is now available in 0.3.0. See the docs for how to use this.

from django-addendum.

Related Issues (6)

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.