Login

I18n Get all language models with form. Tüm diller için otomatik form

Author:
muslu
Posted:
June 25, 2012
Language:
Python
Version:
1.3
Score:
0 (after 2 ratings)

I18n Get all language with form. Tüm diller için otomatik form

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# -*- coding: utf-8 -*-

from django import template

from django.template import Library

register = template.Library()

from projeadi.dil.models import *


def tumdiller():

    html                    =       ""

    for diloku in Diller.objects.filter(DillerAktif=True):


        html    +=  '<li>'
        html    +=  '<form name="setLang' + diloku.DillerAdi + '" action="/i18n/setlang/" method="POST">'
        html    +=  '<input name="next" type="hidden" value="/" />'
        html    +=  '<input type="hidden" name="language" value="'+ diloku.DillerKisaAdi.lower() +'" />'
        html    +=  '<a href="#" onclick="document.setLang' + diloku.DillerAdi + '.submit();return false;" style="color:#cc6666">' + diloku.DillerAdi + '</a>'
        html    +=  '</form>'
        html    +=  '</li>'


    return html



register.simple_tag(tumdiller)

More like this

  1. Template tag - list punctuation for a list of items by shapiromatron 11 months, 1 week ago
  2. JSONRequestMiddleware adds a .json() method to your HttpRequests by cdcarter 11 months, 2 weeks ago
  3. Serializer factory with Django Rest Framework by julio 1 year, 6 months ago
  4. Image compression before saving the new model / work with JPG, PNG by Schleidens 1 year, 7 months ago
  5. Help text hyperlinks by sa2812 1 year, 7 months ago

Comments

Please login first before commenting.