Djipsum already in new version 1.0.9

By: summonagus ● at Dec. 2, 2016, 4:56 a.m. ● Posted under: #Django, #APP, #Module, #News

Djipsum already in new version 1.0.9. Djipsum is awesome command plugin to generate fake content for Django. What news? Fixed ManyToManyField (return the random objects from many to many field). Fixed ForeignKey Field (return the random object from foreign field). Install:$ pip install djipsum I never test this tool with ...

Read More →

Understanding @user_passes_test Django

By: summonagus ● at Nov. 28, 2016, 10:05 p.m. ● Posted under: #Django, #Tricks, #Security, #Solution, #Problem

Django decorator has a function to manage the user, once of it is user_passes_test. But, in my implementation i found this problem: ERR_TOO_MANY_REDIRECTS, or 'AnonymousUser' object is not iterable. I need to custom the user by instancing from user models, for example: from django.db import models from django.contrib.auth.models import User ...

Read More →

How to implement Django Internationalization

By: summonagus ● at Nov. 17, 2016, 8:27 p.m. ● Posted under: #Tricks, #Solution, #Project, #Django, #Module, #Settings, #Database, #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: #Templates, #Tricks, #Solution, #Django, #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: #Django, #APP, #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: #Project, #Django, #APP, #Settings, #Database, #Problem, #Tricks, #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, #Solution, #Project, #Django, #APP, #Database, #Problem, #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 →