コード例 #1
0
ファイル: lang.py プロジェクト: rimbalinux/LMD3
 def render(self, context):
     request = context['request']
     coordinat = self.coordinat.resolve(context)
     if not coordinat:
         return ''
     latitude, longitude = map(lambda x: singleposformat(float(x)),
                               str(coordinat).split(','))
     return '%s %s, %s %s' % (tr(
         'Utara', request), latitude, tr('Timur', request), longitude)
コード例 #2
0
 def render(self, context):
     request = context['request']
     coordinat = self.coordinat.resolve(context)
     if not coordinat:
         return ''
     latitude, longitude = map(lambda x: singleposformat(float(x)),
             str(coordinat).split(','))
     return '%s %s, %s %s' % (
             tr('Utara', request), latitude,
             tr('Timur', request), longitude)
コード例 #3
0
ファイル: cms.py プロジェクト: rimbalinux/MSISDNArea
def show_menu_lang(context, name='menu-lang'):
    request = context['request']

    menu = []
    try:
        for line in Block.objects.get(name=name).content.splitlines():
            line = line.rstrip()
            try:
                title, url = line.rsplit(' ', 1)
            except:
                continue
            url += '?destination=%s' % request.path
            menu.append({'title': tr(title.strip(), request), 'url': url})
    except Block.DoesNotExist:
        pass

    # Mark the best-matching URL as active
    active = None
    active_len = 0
    # Normalize path
    path = request.path.rstrip('/') + '/'
    for item in menu:
        # url = '/lang/en?destination=/hp/memilih-handphone
        if request.session.get(
                'lang', 'id') == item['url'].split('?')[0].split('/')[-1]:
            active = item
            active_len = len(url)
    if active is not None:
        active['active'] = True
    return {'menu': menu}
コード例 #4
0
ファイル: cms.py プロジェクト: rimbalinux/MSISDNArea
def show_menu(context, name='menu'):
    request = context['request']

    menu = []
    try:
        for line in Block.objects.get(name=name).content.splitlines():
            line = line.rstrip()
            try:
                title, url = line.rsplit(' ', 1)
            except:
                continue
            menu.append({'title': tr(title.strip(), request), 'url': url})
    except Block.DoesNotExist:
        pass

    # Mark the best-matching URL as active
    active = None
    active_len = 0
    # Normalize path
    path = request.path.rstrip('/') + '/'
    for item in menu:
        # Normalize path
        url = item['url'].rstrip('/') + '/'
        # Root is only active if you have a "Home" link
        if path != '/' and url == '/':
            continue
        if path.startswith(url) and len(url) > active_len:
            active = item
            active_len = len(url)
    if active is not None:
        active['active'] = True
    return {'menu': menu}
コード例 #5
0
def show_menu_lang(context, name='menu-lang'):
    request = context['request']

    menu = []
    try:
        for line in Block.objects.get(name=name).content.splitlines():
            line = line.rstrip()
            try:
                title, url = line.rsplit(' ', 1)
            except:
                continue
            url += '?destination=%s' % request.path
            menu.append({'title': tr(title.strip(), request), 'url': url})
    except Block.DoesNotExist:
        pass

    # Mark the best-matching URL as active
    active = None
    active_len = 0
    # Normalize path
    path = request.path.rstrip('/') + '/'
    for item in menu:
        # url = '/lang/en?destination=/hp/memilih-handphone
        if request.session.get('lang','id') == item['url'].split('?')[0].split('/')[-1]:
            active = item
            active_len = len(url)
    if active is not None:
        active['active'] = True
    return {'menu': menu}
コード例 #6
0
def show_menu(context, name='menu'):
    request = context['request']

    menu = []
    try:
        for line in Block.objects.get(name=name).content.splitlines():
            line = line.rstrip()
            try:
                title, url = line.rsplit(' ', 1)
            except:
                continue
            menu.append({'title': tr(title.strip(), request), 'url': url})
    except Block.DoesNotExist:
        pass

    # Mark the best-matching URL as active
    active = None
    active_len = 0
    # Normalize path
    path = request.path.rstrip('/') + '/'
    for item in menu:
        # Normalize path
        url = item['url'].rstrip('/') + '/'
        # Root is only active if you have a "Home" link
        if path != '/' and url == '/':
            continue
        if path.startswith(url) and len(url) > active_len:
            active = item
            active_len = len(url)
    if active is not None:
        active['active'] = True
    return {'menu': menu}
コード例 #7
0
def cms(request):
    return {
        'site_name': tr(settings.SITE_NAME, request),
        'site_copyright': settings.SITE_COPYRIGHT,
        'google_analytics_id': getattr(settings, 'GOOGLE_ANALYTICS_ID', None),
        'google_custom_search_id': getattr(settings, 'GOOGLE_CUSTOM_SEARCH_ID',
                                           None),
    }
コード例 #8
0
ファイル: context_processors.py プロジェクト: rimbalinux/LMD3
def cms(request):
    return {
        'site_name':
        tr(settings.SITE_NAME, request),
        'site_copyright':
        settings.SITE_COPYRIGHT,
        'google_analytics_id':
        getattr(settings, 'GOOGLE_ANALYTICS_ID', None),
        'google_custom_search_id':
        getattr(settings, 'GOOGLE_CUSTOM_SEARCH_ID', None),
    }
コード例 #9
0
ファイル: views.py プロジェクト: rimbalinux/LMD3
def login(request):
    if request.user.is_authenticated():
        return HttpResponseRedirect('/sudah-login-%s' % request.user.username)
    if not request.POST:
        return direct_to_template(request, 'login.html')
    username = request.POST['username']
    password = request.POST['password']
    user = auth.authenticate(username=username, password=password) # just check
    if user is not None and user.is_active:
        auth.login(request, user) # session
        return HttpResponseRedirect('/')
    return direct_to_template(request, 'login.html', {
        'error': tr('Login gagal', request),
        })
コード例 #10
0
ファイル: tools.py プロジェクト: rimbalinux/LMD3
def publish_choices():
    return (
        (True, tr('Terbitkan')),
        (False, tr('Jangan terbitkan'))
        )
コード例 #11
0
def genders():
    return (
        (True, tr('Laki-laki')),
        (False, tr('Perempuan')),
    )
コード例 #12
0
from django.db import models
from livecenter.models import Location
from livecenter.tools import GeoModel
from translate.lang import tr

KATA_TIPE = tr('Tipe')

TIPE_PINJAMAN = (
    ('Type A', '%s %s' % (KATA_TIPE, 'A')),
    ('Type B', '%s %s' % (KATA_TIPE, 'B')),
    ('Type C', '%s %s' % (KATA_TIPE, 'C'))
    )

SYARAT_AGUNAN = (
    ('Ya', tr('Ya')),
    ('Tidak', tr('Tidak'))
    )
 
JFPR = (
    ('Ada', tr('Ada')),
    ('Belum', tr('Belum'))
    )


class Finance(GeoModel):
    name_org  = models.CharField('nama organisasi', max_length=100) 
    contact_name = models.CharField('nama kontak', max_length=100) 
    address = models.CharField('alamat', max_length=100) 
    sub_district = models.ForeignKey(Location, null=True, related_name='+', verbose_name='kecamatan') 
    district = models.ForeignKey(Location, null=True, related_name='+', verbose_name='kabupaten') 
    mobile = models.CharField('telepon selular', max_length=20, blank=True) 
コード例 #13
0
ファイル: models.py プロジェクト: rimbalinux/LMD3
def training_choices():
    kali = tr('kali')
    items = []
    for i in range(20):
        items.append((i, '%d %s' % (i, kali)))
    return items
コード例 #14
0
def training_choices():
    kali = tr('kali')
    items = []
    for i in range(20):
        items.append((i,'%d %s' % (i, kali)))
    return items
コード例 #15
0
ファイル: tools.py プロジェクト: rimbalinux/LMD3
def publish_choices():
    return ((True, tr('Terbitkan')), (False, tr('Jangan terbitkan')))