jazzband / django-sorter Goto Github PK
View Code? Open in Web Editor NEWA helper app for sorting objects in Django templates.
Home Page: https://django-sorter.readthedocs.io
License: BSD 3-Clause "New" or "Revised" License
A helper app for sorting objects in Django templates.
Home Page: https://django-sorter.readthedocs.io
License: BSD 3-Clause "New" or "Revised" License
I have a model, ordered by criteria. When I pass it to the template, the sorting is not saved
I think, you should add check if the "ordering" variable is empty do not call order_by([])
Something like this return value.order_by(*ordering) if ordering else value
class Sort(SorterAsTag):
"""
{% sort queryset [with NAME] as VARIABLE %}
{% sort object_list with "objects" as sorted_objects %}
"""
data = ttag.Arg()
with_ = ttag.Arg(named=True, required=False, default=settings.SORTER_DEFAULT_QUERY_NAME)
def as_value(self, data, context):
value = data['data']
ordering = self.ordering(context, data['with'])
return value.order_by(*ordering) if ordering else value
Django 1.2.5
P.S. Sorry for my english :(
Since Django 1.8 the render_to_string
function takes a different set of argument. Support for this deprecated behavior is dropped from Django 1.10.
Another issue that prevents this app from being used in current environments is a failing import in django-ttag.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.