BLOG

A LITTLE STORY ABOUT MY JOURNEY

Django translation in URLs and locale switching

Adding locale switcher to templates Django comes with a view, django.views.i18n.set_language(), that sets a user’s language preference and redirects back to the previous page. This view ca be activated by adding URL like (r’^i18n/’, include(‘django.conf.urls.i18n’)), to urlconf (see Below example). In order to add locale switcher to your templates you will have to add a […]

Screen Shot 2015-03-30 at 10.43.51

Django imageField show image

Problem: Django imageField now shows image ( like <img src=”image_path.ext”/>), i want to display path as image Solution:  So that i create one utility.py file with

and when we want to display in app then simply we import this file and call this class as :

formfield_for_dbfield : This is default function in Django […]

1 2 3