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
Tags:
i18n form locale language get all language html form
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. Get active page's url by another language (templatetag) by muratcorlu 2 years, 4 months ago
  2. I18n URLs via Middleware by zerok 7 years, 9 months ago
  3. language switcher in admin by lawgon 5 years, 6 months ago
  4. LocaleMiddleware without browser language discovery by ivellios 2 months, 3 weeks ago
  5. Modeli18n by pavl 4 years, 11 months ago

Comments

Please login first before commenting.