Scripts posted recently tagged to django in Kelpi

1- 10 of 27.

Case-insensitive containment test - django

to icontains django by kere

icontains

Case-insensitive containment test.

Example:

Get filtered first element order by random

to random django by kere

# filter elements by selected and randomize that list and take the first one.

cover_values = CoverMap.objects.filter(selected = True).order_by('?')[0]

filtrar resultados cuyo id esté en un conjunto dado

to django sql id by nando.quintana

if distinct_ids != []:
   ids = "("+", ".join(distinct_ids)+")"
   commented_photos = Photo.objects.extra(where=['id IN '+ids])

hidden input in django

to hidden input django by kere

from django import newforms as forms
from django.newforms.widgets import HiddenInput

class ItemForm(forms.Form):
    lineno = forms.IntegerField(widget=HiddenInput,required=False)

language change form for django and jquery

to jquery django python by nando.quintana

<script type="text/javascript" src="/jquery-1.2.3.min.js"></script>
<script language="text/javascript" >
$(document).ready(function(){
  $("#languagecombo").change(function (){
    $("#languageform").submit()

django templates i18n

to i18n django python bash by anonymous

# go to your project directory and create the (PO) messages file

cd /path/to/my/project 
mkdir locale
/path/to/my/django/bin/make-messages.py -l es

Django - Force http 301 results

to Django http by kere

return HttpResponsePermanentRedirect(' your redirection url')

Access django trought a python shell script

to django python console script by nando.quintana

#!/usr/bin/python
from sys import path
path.append('/path/to/folder/where/argazkiak_org/is/')
from argazkiak_org.photokora.models import TempPhoto
print TempPhoto.objects.all()

Launch a django script from console

to django python console script bash by nando.quintana

#!/bin/bash

export DJANGO_SETTINGS_MODULE=argazkiak_org.settings
python /var/csmant/django/argazkiak_org/photokora/background_process.py

template tag to build a dictionary parsing an string

to django python exif templatetag by nando.quintana

@register.tag(name="print_exif")
def do_print_exif(parser, token):
    try:
        tag_name, exif = token.contents.split()
    except ValueError:
hits counter