Simple views method binding
@match_func_by_method def frontpage (request) : pass def get_frontpage (request, argument, ) : # GET things pass def post_frontpage (request, argument, ) : # POST things pass
- views
- http-method
@match_func_by_method def frontpage (request) : pass def get_frontpage (request, argument, ) : # GET things pass def post_frontpage (request, argument, ) : # POST things pass
Django supports the serializing model objects, but does not support the serializing Q object like that, ============================ q = Q(username__contains="findme") model0.objects.filter(q) serialize(q) # X ============================ so I wrote a little marshaller for Q, this is example, ============================ from django.contrib.auth import models as django_models qs = django_query.Q(username__contains="spike") | django_query.Q(email__contains="spike") _m = QMarshaller() a = _m.dumps(qs) # a was serialized. When call the similiar queries in page by page, you don't need to write additional code for creating same Q(s) for filtering models, just use the serialized Q as http querystring and in the next page unserialize and apply it. That is simple life.
If you use javascript code with Django-template filter or other related things, it will be not sufficient to qoute string in javascript. This filter escape the string and quote it.
SpikeekipS has posted 3 snippets.