Happy 6th Anniversary 7Langit!

  • Posted on: 7 August 2015
  • By: oon
happy 6th anniversary 7Langit

Dear 7Langit & ALL 7Langit team,

happy anniversary for YOU!

thank you for bringing joy and happiness to us and many people. 

(also sadness too, but, you know, it's not worth to mention).





my best prayer for YOU.

let's make wishes!

hopefully, we have more chance, to be more happy & useful for God, country, and people!



Using AWS CodeCommit as Code Repository

  • Posted on: 9 July 2015
  • By: oon

Just like other code repository, we can use HTTPS or SSH channel.

here's the reference if you want to remote your local git repository using HTTPS and aws cli: http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-https-...

oh, anyway create your aws cli profile with this reference: http://docs.aws.amazon.com/cli/latest/reference/configure/index.html


Django Template Not Support Simple Math Calculation

  • Posted on: 27 May 2015
  • By: oon
Django, web framework for perfectionists with deadlines

I used to use Jinja2 for templating, and it support Math calculation [1].

Now when try Django template, I can't calculate simple math (only add available via builtin filter), so I have to implement filter by myself, or using django-mathfilters [2].

What do you need is only install mathfilters with pip then add mathfilters to INSTALLED_APPS on your settings.

Easier to Ask for Forgiveness than for Permission (EAFP)

  • Posted on: 2 May 2015
  • By: oon

There is a rule in Python programming called "it is Easier to Ask for Forgiveness than for Permission" (in short: EAFP). It means that you should catch exceptions instead of checking values for validity.





Django Model Serializer

  • Posted on: 5 April 2015
  • By: oon

How to serialize model to JSON on Django?

Django has serializers module on it's core.

from django.core import serializers 
from myproject.myapp import models 
data = serializers.serialize("json", models.MyModel.objects.all())

really simple :)


Jinja2 syntax equivalent to Django's URL name and static

  • Posted on: 4 April 2015
  • By: oon
Django's template URL name like for Jinja2

(after start using Jinja2 on Django)

I need to use Django syntax {% url %} in Jinja2, here's my reference [1].

{{ url('index', args=[variable]) }}

And Django syntax {% static %} also similar.

{{ static('path') }}

hope it helps!