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!



Install and Start Project Django

  • Posted on: 2 April 2015
  • By: oon

Install Django with pip package manager, for example inside (virtual) environment, install version 1.8 LTS:

pip install "django < 1.9"

You can check your install version (not only using pip also) with command django-admin

django-admin --version

 for example it will output: 1.8

Now we are ready to create Django project:

django-admin startproject rdjango

it will create directory rdjango, and inside the directory there will be these files:

How Jetbrains, the Producer of IntelliJ IDEA Supports Tech Course

  • Posted on: 1 April 2015
  • By: oon
IntelliJ IDEA license for oon arfiandwi

I have a great experience of using Android Studio and also IntelliJ IDEA.

I told the Jetbrains team about my activities in tech education, I have course about introduction to Python programming languange and Cloud platform.

and they support me with their IntelliJ IDEA license!

awesome, Jetbrains team!


Table Relationship in SQLAlchemy without ForeignKey

  • Posted on: 5 March 2015
  • By: oon
SQLAlchemy Relationship

Secara umum Relationship di SQLAlchemy dibangun dengan mengecek ForeignKey antara 2 table, tapi jika ingin membentuk Relationship lain, bisa menggunakan pendefinisian join seperti dijelaskan pada situs berikut.

Masih bingung dengan Relationship di SQLAlchemy? Artikel berikut ini memberikan penjelasan yang mudah dan disertai contoh.