JsonResponse
A subclass of `HttpResponse` useful as a shortcut in views; it chooses the correct JSON serializer based on whether or not it is passed a QuerySet.
- ajax
- serialize
- json
A subclass of `HttpResponse` useful as a shortcut in views; it chooses the correct JSON serializer based on whether or not it is passed a QuerySet.
Add this as a superclass of any Django model to allow making copies of instances of that model: class Entry(models.Model, CloneableMixin): [...] e = Entry.objects.get(...) e_clone = e.clone() e_clone.title = 'Cloned Entry' e.save() The new object is saved during the clone process and ManyToMany relations are copied as well.
Much stolen from base `truncate_html_words`. The difference is that this filter takes a number of characters as its argument and truncates to the nearest word boundary less than that count, rather than specifying a number of words.