How to implement Django Internationalization

By: summonagus ● at Nov. 17, 2016, 8:27 p.m. ● Posted under: #Tricks, #Database, #Settings, #Module, #Django, #Project, #Solution, #Internationalization, #Multi Languages

Django is real fucking awesome, this morning i want to share a basic tutorial how to implement the django internationalization with GeoIP. Of course this tutorial if you need to make a site with multiple languages. Default django already integrated with common / modern translation system. as the docs warning ...

Read More →

Implement Realtime Search using Django and Ajax

By: summonagus ● at Nov. 13, 2016, 12:17 a.m. ● Posted under: #Tricks, #Templates, #Django, #Solution, #Ajax

Hello guys and welcome back, this night i want to share a simply tutorial how to Implement Realtime Search using Django and Ajax. Lets goo... ^_^1. yourapp/models.pyfrom django.db import models class Post(models.Model): title = models.CharField(max_length=200) description = models.TextField() 2. yourapp/views.pyfrom django.shortcuts import render from django.db.models import Q from yourapp.models import ...

Read More →

Django Contact Form Widget

By: summonagus ● at Nov. 3, 2016, 2:42 p.m. ● Posted under: #APP, #Django, #Project, #Ajax

Django contact widget is once of plugin i already released. This is simple contact widget plugin for Django. inspired from https://github.com/ubernostrum/django-contact-form, but made more simple and easy to use. Demohttps://github.com/agusmakmun/django-contact-widget/tree/master/contact_widget_demoInstallDjango Contact Widget is available directly from PyPI: $ pip install django-contact-widget *). And don't forget to add "contact_widget" to your ...

Read More →

Step by step how to use multiple databases with database routers in Django

By: summonagus ● at Oct. 26, 2016, 11:29 p.m. ● Posted under: #Tricks, #Problem, #Database, #Settings, #APP, #Django, #Project, #Solution, #SSO, #Multi Databases

1. Please create a new superuser for the second/default/current database. Because you will getting this issue that i already asked before: https://gitter.im/django/django?at=5810b0b5806316005dc11f46 i use multiple site, multiple env, multiple project, multiple database. and found this error message if use DATABASE_ROUTERS. insert or update on table "django_admin_log" violates foreign key constraint ...

Read More →

How to implement the ForeignKey for multi databases Django

By: summonagus ● at Oct. 23, 2016, 6:12 a.m. ● Posted under: #Tricks, #Problem, #Database, #APP, #Django, #Project, #Solution, #SSO, #Multi Databases, #Ajax

Previously i had confused how to handle this problem, this problem also already asked by someone on stackoverflow (Cross Database foreign key error) and has the best answered by someone http://stackoverflow.com/a/23273703/6396981 with quote: If you have used a router to partition models to different databases, any foreign key and many-to-many ...

Read More →

Simply how to fix .rst (reStructuredText) for PyPi

By: summonagus ● at Oct. 15, 2016, 2:54 a.m. ● Posted under: #Tricks, #Problem, #Solution

Hello guys, this night i want to share simply tutorial how to fix .rst (reStructuredText) format for PyPi. This problem simple but important. previously, i was confused to handle this situation. I has been checkout at http://docutils.sourceforge.net/docs/user/rst/quickref.html, but yeah maybe the problem only about a little characters.You can checkout at ...

Read More →

Djipsum: Plugin to generate the lorem ipsum (fake content) for django model

By: summonagus ● at Oct. 11, 2016, 4:51 p.m. ● Posted under: #Module, #APP, #Django, #News, #Project, #Solution

Djipsum Plugin to generate the lorem ipsum (fake content) for django model. Sometimes, I feel bored when i want to create many contents such as fake content in once time. and thid Djipsum specially maded to solved it. This plugin is made using management.commands from django. InstallDjipsum is available directly ...

Read More →

Understanding Google reCAPTCHA in Django

By: summonagus ● at Oct. 9, 2016, 7:01 p.m. ● Posted under: #Django, #Security, #API

Understanding Google reCAPTCHA in Django. I found this awesome answer to simply understand how to use API from Google reCAPTCHA. import urllib, urllib2 def recaptcha(request, postdata): rc_challenge = postdata.get('recaptcha_challenge_field', '') rc_user_input = postdata.get('recaptcha_response_field', '').encode('utf-8') url = 'http://www.google.com/recaptcha/api/verify' values = { 'privatekey': 'XXXXXXXXXXXXXXXXXXXXXXX', 'remoteip': request.META['REMOTE_ADDR'], 'challenge': rc_challenge, 'response': rc_user_input } data ...

Read More →

Django: Redirect HTTP to HTTPS

By: summonagus ● at Oct. 8, 2016, 4:24 a.m. ● Posted under: #Settings, #Django, #Security, #Solution

Django: Redirect HTTP to HTTPS, basically the Django already support to handle this redirection at https://docs.djangoproject.com/en/dev/topics/security/#ssl-httpsEdit in your settings.py # Redirecting from `HTTP` to `HTTPS` for Django 1.8 or later SECURE_SSL_REDIRECT = True SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') Hope it usefull..

Read More →

Create Command Line interfaces with Python

By: summonagus ● at Oct. 8, 2016, 3:58 a.m. ● Posted under: #Tricks, #Module

Building command line programs has been a long time passion of mine. There’s something magical about making a simple, intuitive, and composable CLI. There’s also nothing more beautiful than chaining together a series of CLI programs to solve a complex problem quickly. Here at Stormpath, we’ve built our entire product ...

Read More →