djangosnippets.org: Latest snippets posted by SpikeekipShttps://djangosnippets.org/users/SpikeekipS/2008-06-10T08:21:36.401107-05:00SpikeekipSSimple views method binding
2008-06-10T08:21:36.401107-05:00SpikeekipShttps://djangosnippets.org/snippets/789/<p>@match_func_by_method
def frontpage (request) : pass</p>
<p>def get_frontpage (request, argument, ) :
# GET things
pass</p>
<p>def post_frontpage (request, argument, ) :
# POST things
pass</p>
Freely redistributableQ marshaller
2008-03-11T07:11:45.960661-05:00SpikeekipShttps://djangosnippets.org/snippets/640/<h1>Django supports the serializing model objects, but does not support the serializing Q object like that,</h1>
<p>q = Q(username__contains="findme")
model0.objects.filter(q)</p>
<h1>serialize(q) # X</h1>
<h1>so I wrote a little marshaller for Q, this is example,</h1>
<p>from django.contrib.auth import models as django_models
qs = django_query.Q(username<strong>contains="spike") | django_query.Q(email</strong>contains="spike")</p>
<p>_m = QMarshaller() …</p>
Freely redistributableGenerate Javascript-Safe string in template
2007-02-25T21:37:48.131228-06:00SpikeekipShttps://djangosnippets.org/snippets/18/<p>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.</p>
Freely redistributable