<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2299763478272042075</id><updated>2011-12-21T01:07:22.874-08:00</updated><category term='Python'/><category term='Dojo'/><category term='Django'/><category term='Database'/><category term='DataGrid'/><category term='Django widget SelectMultiple'/><category term='xhrget'/><category term='CSV'/><category term='ubuntu'/><category term='Virtualization'/><category term='Interview'/><category term='QuerySet'/><category term='psql'/><category term='Ajax'/><category term='xen'/><category term='postgreSQL'/><title type='text'>Future Of Technology - Django</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-4949305460220511373</id><published>2011-12-21T01:00:00.000-08:00</published><updated>2011-12-21T01:07:22.897-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='QuerySet'/><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Django not equal queryset filtering</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction:&lt;/span&gt;&lt;br /&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     This section will teach you to How to create not equal queryset filtering.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Method:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;from django.db.models import Q&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Models.objects.exclude(MyField='foo')&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Models.objects.filter(~Q(MyField='foo'))&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-4949305460220511373?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/4949305460220511373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2011/12/django-not-equal-queryset-filtering.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/4949305460220511373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/4949305460220511373'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2011/12/django-not-equal-queryset-filtering.html' title='Django not equal queryset filtering'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-1453399213646409777</id><published>2011-12-21T00:36:00.000-08:00</published><updated>2011-12-21T00:58:23.419-08:00</updated><title type='text'>django Q objects for complex query</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction:&lt;/span&gt;&lt;br /&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     This section will teach you to How to create complex query/filter using django Q objects.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Method:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;from django.db.models import Q&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;q_object = Q()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;q_object.add(Q(MyField__icontains='foo'), Q.OR) # OR'ing&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;q_object.add(Q(MyField__icontains='foo'), Q.AND) # AND'ing&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;q_object.add(Q(**{'MyField': 'foo'}), Q.AND) # QueryDict&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-1453399213646409777?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/1453399213646409777/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2011/12/django-q-objects-for-complex-query.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/1453399213646409777'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/1453399213646409777'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2011/12/django-q-objects-for-complex-query.html' title='django Q objects for complex query'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-7763539605464808157</id><published>2010-11-15T22:32:00.000-08:00</published><updated>2010-11-15T22:58:59.297-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><title type='text'>django dynamic menu</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction:&lt;/span&gt;&lt;br /&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     This section will teach you to How to create dynamic menu in templates. Here we used ``context processors``&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Method:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;create a file say `&lt;span style="font-style: italic;"&gt;context_processors.py&lt;/span&gt;` inside your application folder.&lt;/li&gt;&lt;li&gt;File looks like&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;from models import GameCategory&lt;br /&gt;def Category(request):&lt;br /&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;category_list=list(GameCategory.objects.all())&lt;br /&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return {'category_list':category_list}&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;In &lt;span style="font-style: italic;"&gt;Settings.py&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;TEMPLATE_CONTEXT_PROCESSORS = (&lt;br /&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;'MyProject.MyApplication.&lt;span style="font-style: italic;"&gt;context_processors&lt;/span&gt;.Category', # path to above-said file(&lt;span style="font-style: italic;"&gt;context_processors.py&lt;/span&gt;)&lt;br /&gt;)&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;Now you can able to get the ``category_list`` in your &lt;span style="font-style: italic;"&gt;Base.html&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-7763539605464808157?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/7763539605464808157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/django-dynamic-menu-in-template.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/7763539605464808157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/7763539605464808157'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/django-dynamic-menu-in-template.html' title='django dynamic menu'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-4356976066834823381</id><published>2010-11-13T03:26:00.000-08:00</published><updated>2010-11-13T03:40:13.820-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSV'/><category scheme='http://www.blogger.com/atom/ns#' term='postgreSQL'/><category scheme='http://www.blogger.com/atom/ns#' term='psql'/><title type='text'>Import &amp; Export as CSV in PostgreSQL using copy command</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;         Easy way to Import &amp;amp; Export as CSV file in postgreSQL using psql copy command.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Query:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;Import&lt;br /&gt;COPY tablename  From '/absolute _path_to_file/filename.csv' DELIMITERS '|' WITH NULL AS '';&lt;br /&gt;&lt;br /&gt;Export&lt;br /&gt;COPY tablename  To '/absolute _path_to_file/filename.csv' DELIMITERS '|' WITH NULL AS '';&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Constraints&lt;/span&gt;:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;User should be superuser i.e &lt;span style="font-style: italic;"&gt;postgres.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Path should be absolute and have full permission (chmod 777)&lt;/span&gt;&lt;span style="font-style: italic;"&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;Should be in local-machine where postgreSQL installed.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;While importing data from csv to DB, the field and data order should be same. (Say, If we have table with fields as ID &amp;amp; Name, then data in csv file should be 1 &amp;amp; Jayapal )&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-4356976066834823381?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/4356976066834823381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/import-export-as-csv-in-postgresql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/4356976066834823381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/4356976066834823381'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/import-export-as-csv-in-postgresql.html' title='Import &amp; Export as CSV in PostgreSQL using copy command'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-1240065923548121165</id><published>2010-11-13T02:55:00.000-08:00</published><updated>2010-11-13T03:19:52.078-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Python  Pincode Search in address</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Script use to get the pincode from a address. I used regulatr expression to find it. At first, we will check check pincode end of address. If we didn't get, then check between address. Here I assumed pincode starts with 7 and len should be 6 (ex 700002)&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Script:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;def getPin(myStr):&lt;br /&gt;   pin=re.search(r"7(\d{0,5})$",myStr)# check for pincode end of string&lt;br /&gt;   if not pin:&lt;br /&gt;       pin=re.search(r"7(\d{0,5})[ ]",myStr) # check for pincode in between string&lt;br /&gt;return pin&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-1240065923548121165?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/1240065923548121165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/introduction-script-use-to-get-pincode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/1240065923548121165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/1240065923548121165'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/introduction-script-use-to-get-pincode.html' title='Python  Pincode Search in address'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-7835284762640418583</id><published>2010-11-13T02:33:00.000-08:00</published><updated>2010-11-13T02:43:30.858-08:00</updated><title type='text'>Python ignoring NULL characters</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;                Simply ignoring NULL characters while reading CSV file.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Script:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;def nonull(stream):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;for line in stream:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;yield line.replace('\x00', '')&lt;br /&gt;&lt;br /&gt;reader = csv.reader(nonull(open(os.getcwd()+"/test.csv")), dialect='excel', delimiter='|')&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-7835284762640418583?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/7835284762640418583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/python-ignoring-null-characters.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/7835284762640418583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/7835284762640418583'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/python-ignoring-null-characters.html' title='Python ignoring NULL characters'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-8962851767521522611</id><published>2010-11-13T02:05:00.000-08:00</published><updated>2010-11-13T02:44:15.153-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSV'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Python check whether string is in printable format</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;                      Check whether string is in printable format. This would be useful when we parse unformatted csv file.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Script:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;def check(myStr):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return filter(lambda x: x in string.printable, myStr)&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-8962851767521522611?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/8962851767521522611/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/python-check-whether-string-is-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/8962851767521522611'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/8962851767521522611'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/python-check-whether-string-is-in.html' title='Python check whether string is in printable format'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-6808902593917536342</id><published>2010-11-04T00:09:00.000-07:00</published><updated>2010-11-04T00:37:06.841-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interview'/><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><category scheme='http://www.blogger.com/atom/ns#' term='Database'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Django Interview Question</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction:&lt;/span&gt;&lt;br /&gt;     &lt;ul&gt;&lt;li&gt;I like to share Django Python interivew question which I attended during Sep &amp;amp; Oct 2010&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Django&lt;/span&gt;:&lt;br /&gt;&lt;blockquote&gt;1.How django works (work flow)&lt;br /&gt;2.what is  __init__.py inisde application folder?&lt;br /&gt;3.What is the use of manage.py&lt;br /&gt;4.how you will add extra function/feature in admin part&lt;br /&gt;5.have you customized admin style?&lt;br /&gt;6.what are all middleware you used and whats the purpose ot it?&lt;br /&gt;7.how you used session ? How can we handle session expire time ?&lt;br /&gt;8.how you will write django complex query?&lt;br /&gt;9.Django group_by query&lt;br /&gt;10.what is signals and how to use it? What are two important parameter in signals?&lt;br /&gt;11.Have you write templatetags? Whats the use of it?&lt;br /&gt;12.form inheritance&lt;br /&gt;13.model inheritance&lt;br /&gt;14.How to get all logged-in user list or count&lt;br /&gt;15.what are all reusable application u used in django prjt&lt;br /&gt;16.save dynamic data without using DB/file.&lt;br /&gt;17.How you are requesting ajax in django? How it works?&lt;br /&gt;18.how u ill access a particular block in child html?&lt;br /&gt;19.how u are debugging applicaiton?&lt;br /&gt;20.logging module have u used ?&lt;br /&gt;21.What is message framework and explain it&lt;br /&gt;22.what are modules in django?&lt;br /&gt;23.What is serialization and why we are using it?&lt;br /&gt;24.How you are testing your application?&lt;br /&gt;25.How you are deploying applicaiton with apache?&lt;br /&gt;26.Whats the difference between mod_python &amp;amp; mod_wsgi&lt;br /&gt;27.What are all new featues in django latest version&lt;br /&gt;28.whats major advantage in django 1.2&lt;br /&gt;29.which function wont run in django 1.2 which runs in django 1.0&lt;br /&gt;30. If Django powerd application is high traffi site then how you will reduce the traffic?&lt;br /&gt;31. How to modify model without affecting datas?&lt;br /&gt;32. What are things we have to consider while designing models&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;Python:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;1.What is datatype(this is first question asked b y all interviewer)&lt;br /&gt;2.list, tuple, dict diff&lt;br /&gt;3.list sorting without using generic function&lt;br /&gt;4.can we use list as key in dict?&lt;br /&gt;5.Dict sorting both key and value sorting&lt;br /&gt;6.what is Listcomprehension and where you use it?&lt;br /&gt;7.What is iterator, generator?&lt;br /&gt;8.How to get traceback? expalin&lt;br /&gt;9.how to write class&lt;br /&gt;10.what is __init__&lt;br /&gt;11.what is self&lt;br /&gt;12.wts is constructor&lt;br /&gt;13.wts decorator ? How it works? How to write custom decorator?&lt;br /&gt;14.wts is __init__  and  __new&lt;br /&gt;15.wts is super function in python and where you ill use&lt;br /&gt;16.hv u used set() ? if so wr (Note that Set()  depreciated in python 2.6)&lt;br /&gt;17.single linked list?&lt;br /&gt;18.Which version you are using?&lt;br /&gt;19.Deprecation in python latest version or version which you are working&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Database:&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;1.If we modify a models, then error will arise while accessing admin? Hw can we fix it? data shoouldn't miss from table&lt;br /&gt;2.if the modified models filed is primary then how can we do that?&lt;br /&gt;3.if the primary key is override then how can we do it?&lt;br /&gt;4.if the primary key is from another table as foregin key, then hwo can we do it?&lt;br /&gt;5.DB master, slave,cluster?&lt;br /&gt;6.Table joining query&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-6808902593917536342?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/6808902593917536342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/django-interview-question.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/6808902593917536342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/6808902593917536342'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2010/11/django-interview-question.html' title='Django Interview Question'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-1154025561104061818</id><published>2009-08-29T02:06:00.000-07:00</published><updated>2010-11-04T00:37:06.842-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DataGrid'/><category scheme='http://www.blogger.com/atom/ns#' term='xhrget'/><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='Dojo'/><title type='text'>Dojo Datagrid with editable cells in django</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Implementation of dojo datagrid with editable cells, update cell values with the use of dojo xhrget method, then save the edited datagird and send data to server as josn format to update data in database.&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Jsonformat&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;{ "identifier": "id", "label": "uniqueid", "items": [ {id: '1',image:'jai.png',name: 'Jayapal',address:'Trivandrum,Kerala,India',gender:'Male'}] }&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;DataGrid.html&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;First import necessary css and script for dojo&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;@import "/{{MEDIA_URL}}/js/dojo/dojox/grid/_grid/tundraGrid.css";&lt;br /&gt;@import "/{{MEDIA_URL}}/js/dojo/dijit/themes/tundra/tundra.css";&lt;br /&gt;@import "/{{MEDIA_URL}}/js/dojo/dojo/resources/dojo.css";&lt;br /&gt;@import "/{{MEDIA_URL}}/js/dojo/dojox/grid/resources/Grid.css";&lt;br /&gt;@import "/{{MEDIA_URL}}/js/dojo/dojox/grid/resources/tundraGrid.css";&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="/PathToDojo/dojo/dojo.js" djConfig="parseOnLoad:true"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;Import select- All, None and Toggle function which is written by myself.&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt; &amp;lt;script type="text/javascript"  src="/{{MEDIA_URL}}/js/GridFunction.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;GridFunction.js&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&lt;br /&gt;/*Function for select ALL in dojo grid*/&lt;br /&gt;function SelectAll()&lt;br /&gt;{&lt;br /&gt;var grid=dijit.byId('GridTable');&lt;br /&gt;var gridstore=dijit.byId('GridTable').store;&lt;br /&gt;gridstore.fetch({onComplete:function(items,request)&lt;br /&gt;{&lt;br /&gt;var i;&lt;br /&gt;for (i=0;i&amp;lt;grid.rowCount;i++)&lt;br /&gt;{&lt;br /&gt;gridstore.setValue(items[i],"Select" ,true);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;});&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*Function for select NONE in dojo grid*/&lt;br /&gt;function SelectNone()&lt;br /&gt;{&lt;br /&gt;var grid=dijit.byId('GridTable');&lt;br /&gt;var gridstore=dijit.byId('GridTable').store;&lt;br /&gt;gridstore.fetch({onComplete:function(items,request)&lt;br /&gt;{&lt;br /&gt;var i;&lt;br /&gt;for (i=0;i&amp;lt;grid.rowCount;i++)&lt;br /&gt;{&lt;br /&gt;gridstore.setValue(items[i],"Select" ,false);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;});&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;/*Function for select Toggle  in dojo grid*/&lt;br /&gt;function Toggle()&lt;br /&gt;{&lt;br /&gt;var grid=dijit.byId('GridTable');&lt;br /&gt;var gridstore=dijit.byId('GridTable').store;&lt;br /&gt;gridstore.fetch({onComplete:function(items,request)&lt;br /&gt;{&lt;br /&gt;var i;&lt;br /&gt;for (i=0;i&amp;lt;grid.rowCount;i++)&lt;br /&gt;if (gridstore.getValue(items[i],"Select")==true)&lt;br /&gt;{&lt;br /&gt; gridstore.setValue(items[i],"Select" ,false);&lt;br /&gt;}&lt;br /&gt;else if  (gridstore.getValue(items[i],"Select")==false)&lt;br /&gt;{&lt;br /&gt; gridstore.setValue(items[i],"Select" ,true);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;});&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt; &lt;ul&gt;&lt;li&gt;Function for store the datagrid after editing the diffeent cells in the data grid and data will be send to the server as json format.&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;var fillStore = function(){&lt;br /&gt;dijit.byId('GridTable').store._saveEverything = function(saveCompleteCallback, saveFailedCallback, newFileContentString){&lt;br /&gt;console.log(newFileContentString);&lt;br /&gt;dojo.xhrPost({&lt;br /&gt;url: "/yourproject/application/",&lt;br /&gt;postData: dojo.toJson(dojo.fromJson(newFileContentString)),&lt;br /&gt;error: saveFailedCallback,&lt;br /&gt;load: function(response, ioArgs)&lt;br /&gt;{&lt;br /&gt;alert(response) ;&lt;br /&gt;dijit.byId('GridTable').store.save();&lt;br /&gt;}&lt;br /&gt;,&lt;br /&gt;});&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;dojo.addOnLoad(fillStore);&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;Function for embedded image in datagrid.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function CreateImage(value)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;var imgtag=" &amp;lt;img title=\"Click here to zoom the image \" style=\"cursor:pointer; \" onclick= \" return ImagePopUp('"+value+"');\" src='/{{MEDIA_URL}}/Thumbnails/"+value+"' alt='NA' &amp;gt;";&lt;br /&gt;return imgtag;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;Html content along with ItemFileWriteStore for load the data json from the url mentioned.&lt;/li&gt;&lt;li&gt;You can find a script written just after table tag. That script will be triggered when any cell is edited in &lt;a href="http://docs.dojocampus.org/dojox/grid"&gt;datagrid&lt;/a&gt;. The 'onApplyCellEdit' event returns  New value, RowIndex, fieldtype. You can find more events &lt;a href="http://api.dojotoolkit.org/jsdoc/1.2/dojox.grid._Events"&gt;here&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;If you need to enable edit any cell, then you need to give &lt;span style="font-style: italic; color: rgb(51, 0, 153);"&gt;editable="true"&lt;/span&gt;. You need to double click the cell for edit. If you want to make the cells alwys as editable field then we need to give as &lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;alwaysEditing='true'&lt;/span&gt;.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;For embedded image in datagrid then we need to call a javascript while loading. For that we used&lt;span style="color: rgb(51, 0, 153);"&gt; &lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;span style="color: rgb(51, 0, 153);"&gt;formatter="CreateImage"&lt;/span&gt;  &lt;/span&gt;which will return image tag. &lt;span style="font-style: italic;"&gt;Formatter&lt;/span&gt; A JavaScript function that is called which returns the value to be shown in the cell. The value from the data store is passed as a parameter to the function. The returned value that is inserted into the page can be any legal HTML&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&amp;lt;BODY class="tundra"&amp;gt;&amp;lt;span dojoType="dojo.data.ItemFileWriteStore"   jsId="store" url="/yourpath/getJson/"&amp;gt;&lt;br /&gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;div id="SelectMenu"&amp;gt;Select &amp;lt;a href="#" onclick="SelectAll();"&amp;gt; All &amp;lt;/a&amp;gt;&amp;lt;a href="#" onclick="SelectNone();"&amp;gt; None &amp;lt;/a&amp;gt; &amp;lt;a href="#" onclick="Toggle();"&amp;gt;Toggle &amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;table id="GridTable" dojoType="dojox.grid.DataGrid"&lt;br /&gt;jsId="grid6"&lt;br /&gt;store="store"&lt;br /&gt;query="{ uniqueid: '*' }"&lt;br /&gt;rowsPerPage="20"&lt;br /&gt;clientSort="true"&lt;br /&gt;style="width: 100%;"&lt;br /&gt;height="85%"&lt;br /&gt;rowSelector="20px"&amp;gt;&lt;br /&gt;&amp;lt;script type="dojo/connect" event="onApplyCellEdit" args="Name,rowIndex,fieldType"&amp;gt;&lt;br /&gt;&lt;br /&gt;if (fieldType=="Name")&lt;br /&gt;{&lt;br /&gt;dojo.xhrGet( {&lt;br /&gt;url: "/URL/getAddress/"+Name+"/",&lt;br /&gt;load: function(data){&lt;br /&gt;if (data)&lt;br /&gt;{&lt;br /&gt;if (data== -1)&lt;br /&gt;{&lt;br /&gt;var item = grid6.getItem(rowIndex);&lt;br /&gt;var type = store.getValue(item,"address",null);&lt;br /&gt;rowIndex.customStyles += "color:red;";&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;gridstore=dijit.byId('GridTable').store&lt;br /&gt;gridstore.fetch({onComplete:function(items,request)&lt;br /&gt;{&lt;br /&gt;gridstore.setValue(items[rowIndex],"address" ,data);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;});&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;else { dojo.byId("test").innerHTML = data;}&lt;br /&gt;&lt;br /&gt;},&lt;br /&gt;error: function(data){ console.debug("An error occurred: ", data);},&lt;br /&gt;timeout: 10000,&lt;br /&gt;});&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;thead&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;&amp;lt;th width="1%" field="Select" name="Select" width="5%" editable="true" cellType="dojox.grid.cells.Bool"&amp;gt;&lt;br /&gt;&amp;lt;div dojoType="dijit.form.CheckBox" id="Select" name="Select" value="false" /&amp;gt;&lt;br /&gt;&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;lt;th width="1%" field="id"&amp;gt;Sl No&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;lt;th  width="5%" alwaysEditing='true' field="name" alwaysEditing='true' editable="true"&amp;gt;Name&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;lt;th  width="5%" formatter="CreateImage" field="image"&amp;gt;Image&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;lt;th width="10%" alwaysEditing='true' editable="true"  field="address"&amp;gt;Address&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;lt;th width="8%" alwaysEditing='true' field="gender"  cellType="dojox.grid.cells.Select"&lt;br /&gt;options="Select,Male,Female"&lt;br /&gt;editable="true" &amp;gt;Gender&amp;lt;/th&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/thead&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;center&amp;gt;&amp;lt;button dojoType="dijit.form.Button" onclick="dijit.byId('GridTable').store.save();"&amp;gt;Save Selected items&amp;lt;/button&amp;gt;&amp;lt;/center&amp;gt;&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;Final html page looks like&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;    @import "/{{MEDIA_URL}}/js/dojo/dojox/grid/_grid/tundraGrid.css";&lt;br /&gt;       @import "/{{MEDIA_URL}}/js/dojo/dijit/themes/tundra/tundra.css";&lt;br /&gt;          @import "/{{MEDIA_URL}}/js/dojo/dojo/resources/dojo.css";&lt;br /&gt;   @import "/{{MEDIA_URL}}/js/dojo/dojox/grid/resources/Grid.css";&lt;br /&gt;   @import "/{{MEDIA_URL}}/js/dojo/dojox/grid/resources/tundraGrid.css";&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"  src="/{{MEDIA_URL}}/js/GridFunction.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="/PathToDojo/dojo/dojo.js" djConfig="parseOnLoad:true"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;// this function is used to store the edited datagrid store and sent data to sever in json format&lt;br /&gt;var fillStore = function(){&lt;br /&gt;   dijit.byId('GridTable').store._saveEverything = function(saveCompleteCallback, saveFailedCallback, newFileContentString){&lt;br /&gt;    console.log(newFileContentString);&lt;br /&gt;   dojo.xhrPost({&lt;br /&gt;       url: "/yourproject/application/",&lt;br /&gt;       postData: dojo.toJson(dojo.fromJson(newFileContentString)),&lt;br /&gt;       error: saveFailedCallback,&lt;br /&gt;       load: function(response, ioArgs)&lt;br /&gt;           {&lt;br /&gt;           alert(response)    ;&lt;br /&gt;           dijit.byId('GridTable').store.save();&lt;br /&gt;           }&lt;br /&gt;           ,&lt;br /&gt;       });&lt;br /&gt;   }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;dojo.addOnLoad(fillStore);&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function CreateImage(value)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;var imgtag=" &amp;lt;img title=\"Click here to zoom the image \" style=\"cursor:pointer; \" onclick= \" return ImagePopUp('"+value+"');\" src='/{{MEDIA_URL}}/Thumbnails/"+value+"' alt='NA' &amp;gt;";&lt;br /&gt;return imgtag;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;span dojoType="dojo.data.ItemFileWriteStore"   jsId="store" url="/rlvd/getViolationJson/"&amp;gt;&lt;br /&gt;&amp;lt;/span&amp;gt;&lt;br /&gt;&amp;lt;BODY class="tundra"&amp;gt;&lt;br /&gt;&amp;lt;div id="SelectMenu"&amp;gt;Select &amp;lt;a href="#" onclick="SelectAll();"&amp;gt; All &amp;lt;/a&amp;gt;&amp;lt;a href="#" onclick="SelectNone();"&amp;gt; None &amp;lt;/a&amp;gt; &amp;lt;a href="#" onclick="Toggle();"&amp;gt;Toggle &amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;table id="GridTable" dojoType="dojox.grid.DataGrid"&lt;br /&gt;jsId="grid6"&lt;br /&gt;store="store"&lt;br /&gt;query="{ uniqueid: '*' }"&lt;br /&gt;rowsPerPage="20"&lt;br /&gt;clientSort="true"&lt;br /&gt;style="width: 100%;"&lt;br /&gt;height="85%"&lt;br /&gt;rowSelector="20px"&amp;gt;&lt;br /&gt;&amp;lt;script type="dojo/connect" event="onApplyCellEdit" args="Name,rowIndex,fieldType"&amp;gt;&lt;br /&gt;&lt;br /&gt;if (fieldType=="Name")&lt;br /&gt;{&lt;br /&gt;   dojo.xhrGet( {&lt;br /&gt;           url: "/URL/getAddress/"+Name+"/",&lt;br /&gt;           load: function(data){&lt;br /&gt;               if (data)&lt;br /&gt;               {&lt;br /&gt;                   if (data== -1)&lt;br /&gt;                   {&lt;br /&gt;                   var item = grid6.getItem(rowIndex);&lt;br /&gt;                   var type = store.getValue(item,"address",null);&lt;br /&gt;                   rowIndex.customStyles += "color:red;";&lt;br /&gt;                   }&lt;br /&gt;                   else&lt;br /&gt;                   {&lt;br /&gt;                       gridstore=dijit.byId('GridTable').store&lt;br /&gt;                       gridstore.fetch({onComplete:function(items,request)&lt;br /&gt;                                   {&lt;br /&gt;                                       gridstore.setValue(items[rowIndex],"address" ,data);&lt;br /&gt;                         &lt;br /&gt;                                   }&lt;br /&gt;                               });&lt;br /&gt;                   }&lt;br /&gt;               }&lt;br /&gt;               else { dojo.byId("test").innerHTML = data;}&lt;br /&gt; &lt;br /&gt;           },&lt;br /&gt;           error: function(data){ console.debug("An error occurred: ", data);},&lt;br /&gt;           timeout: 10000,&lt;br /&gt;           });&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;thead&amp;gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;th width="1%" field="Select" name="Select" width="5%" editable="true" cellType="dojox.grid.cells.Bool"&amp;gt;&lt;br /&gt;       &amp;lt;div dojoType="dijit.form.CheckBox" id="Select" name="Select" value="false" /&amp;gt;&lt;br /&gt;   &amp;lt;/th&amp;gt;&lt;br /&gt;   &amp;lt;th width="1%" field="id"&amp;gt;Sl No&amp;lt;/th&amp;gt;&lt;br /&gt;   &amp;lt;th  width="5%" alwaysEditing='true' field="name" alwaysEditing='true' editable="true"&amp;gt;Name&amp;lt;/th&amp;gt;&lt;br /&gt;   &amp;lt;th  width="5%" formatter="CreateImage" field="image"&amp;gt;Image&amp;lt;/th&amp;gt;&lt;br /&gt;   &amp;lt;th width="10%" alwaysEditing='true' editable="true"  field="address"&amp;gt;Address&amp;lt;/th&amp;gt;&lt;br /&gt;   &amp;lt;th width="8%" alwaysEditing='true' field="gender"  cellType="dojox.grid.cells.Select"&lt;br /&gt;           options="Select,Male,Female"&lt;br /&gt;           editable="true" &amp;gt;Gender&amp;lt;/th&amp;gt;&lt;br /&gt;   &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/thead&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;center&amp;gt;&amp;lt;button dojoType="dijit.form.Button" onclick="dijit.byId('GridTable').store.save();"&amp;gt;Save Selected items&amp;lt;/button&amp;gt;&amp;lt;/center&amp;gt;&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;Views.py&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;def SaveJson(request)&lt;br /&gt;    if request.POST:&lt;br /&gt;        getJson=request.POST# get the json from request&lt;br /&gt;        qJson=getJson.copy()# copy the request.POST&lt;br /&gt;        jsonValues=qJson.items()[0][0]&lt;br /&gt;        json=simplejson.loads(jsonValues)# read the json using simplejson&lt;br /&gt;        for item in json["items"]:&lt;br /&gt;            data=SomeModel(name=str(item['name']),address=str(item['address']))&lt;br /&gt;            data.save()&lt;br /&gt;        return HttpResponse("Updated Successfully")&lt;br /&gt;&lt;/blockquote&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-1154025561104061818?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/1154025561104061818/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/08/dojo-datagrid-with-editable-cells-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/1154025561104061818'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/1154025561104061818'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/08/dojo-datagrid-with-editable-cells-in.html' title='Dojo Datagrid with editable cells in django'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-3654950104728316638</id><published>2009-08-27T23:21:00.000-07:00</published><updated>2010-11-04T00:37:06.843-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><category scheme='http://www.blogger.com/atom/ns#' term='Django widget SelectMultiple'/><title type='text'>Reuse Django Admin FilteredSelectMultiple Widget</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;     This document helps you to reuse Django admin part FilteredSelectMultiple widget in our application. For that we need to do the following simple steps.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-family:arial;"&gt;&lt;span style="font-weight: bold;"&gt;Models.py&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Here model Student has many to many field to Subjects. In this case a student can have infinite subjects.&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;class Student(models.Model):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;name=models.CharField(max_length=100)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;subject=ManyToManyField(Subjects)&lt;br /&gt;class Subjects(models.Model):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;sub_name=models.CharField(max_length=100)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;desc=models.CharField(max_length=100)&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;Views.py&lt;/span&gt;&lt;br /&gt;&lt;blockquote&gt;from django.contrib.admin.widgets import FilteredSelectMultiple&lt;br /&gt;from django.forms import ModelForm&lt;br /&gt;from django import forms&lt;br /&gt;&lt;br /&gt;class StudentForm(ModelForm):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;subject=forms.ModelMultipleChoiceField(Subjects.objects.all(),widget=&lt;br /&gt;FilteredSelectMultiple("Subjects",False,attrs={'rows':'10'}))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;class Meta:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;model= Student&lt;br /&gt;def Form(request):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stud_form=StudentForm()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if request.POST:&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stud_form=StudentForm(request.POST)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;stud_form.save()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return render_to_response("success.html")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;else:&lt;br /&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return render_to_response("form.html",{' stud_form': stud_form}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;jsi18n.js&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt; You can load the above script from admin part. please check the url http://localhost/yourproject/admin/jsi18n/. The problem is only admin user can load tis url, so i copied this script in our js folder, since all out enduser need to use this widget.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;blockquote&gt;/* gettext library */&lt;br /&gt;// This function is copied from django admin path&lt;br /&gt;&lt;br /&gt;var catalog = new Array();&lt;br /&gt;&lt;br /&gt;function pluralidx(count) { return (count == 1) ? 0 : 1; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function gettext(msgid) {&lt;br /&gt;var value = catalog[msgid];&lt;br /&gt;if (typeof(value) == 'undefined') {&lt;br /&gt;return msgid;&lt;br /&gt;} else {&lt;br /&gt;return (typeof(value) == 'string') ? value : value[0];&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function ngettext(singular, plural, count) {&lt;br /&gt;value = catalog[singular];&lt;br /&gt;if (typeof(value) == 'undefined') {&lt;br /&gt;return (count == 1) ? singular : plural;&lt;br /&gt;} else {&lt;br /&gt;return value[pluralidx(count)];&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function gettext_noop(msgid) { return msgid; }&lt;br /&gt;&lt;br /&gt;function interpolate(fmt, obj, named) {&lt;br /&gt;if (named) {&lt;br /&gt;return fmt.replace(/%\(\w+\)s/g, function(match){return String(obj[match.slice(2,-2)])});&lt;br /&gt;} else {&lt;br /&gt;return fmt.replace(/%s/g, function(match){return String(obj.shift())});&lt;br /&gt;}&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Style.css&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;css for load default style with images for the widget. Please copy all necessary images(names mentioned in css) form django admin media path to your image directory.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;/*css for admin widgets*/&lt;br /&gt;&lt;br /&gt;/*for FilteredSelectMultiple*/&lt;br /&gt;.selector {&lt;br /&gt; width: 580px;&lt;br /&gt; float: left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector select {&lt;br /&gt; width: 270px;&lt;br /&gt; height: 8em;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector-available, .selector-chosen {&lt;br /&gt; float: left;&lt;br /&gt; width: 270px;&lt;br /&gt; text-align: center;&lt;br /&gt; margin-bottom: 5px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector-available h2, .selector-chosen h2 {&lt;br /&gt; border: 1px solid #ccc;&lt;br /&gt;font-family:"Lucida Grande","DejaVu Sans","Bitstream Vera Sans",Verdana,Arial,sans-serif;&lt;br /&gt;font-size:11px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector .selector-available h2 {&lt;br /&gt;&lt;br /&gt; background: #a6a077 url(/images/admin/nav-bg.gif) bottom left repeat-x;&lt;br /&gt; color: white;&lt;br /&gt;}&lt;br /&gt;.selector .selector-chosen h2 {&lt;br /&gt; background: #A29A63  url(/images/admin/default-bg.gif)  repeat-x scroll left top;&lt;br /&gt; color: white;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.selector .selector-filter {&lt;br /&gt; background: white;&lt;br /&gt; border: 1px solid #ccc;&lt;br /&gt; border-width: 0 1px;&lt;br /&gt; padding: 3px;&lt;br /&gt; color: #999;&lt;br /&gt; font-size: 10px;&lt;br /&gt; margin: 0;&lt;br /&gt; text-align: left;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector .selector-chosen .selector-filter {&lt;br /&gt; padding: 4px 5px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector .selector-available input {&lt;br /&gt; width: 230px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector ul.selector-chooser {&lt;br /&gt; float: left;&lt;br /&gt; width: 22px;&lt;br /&gt; height: 50px;&lt;br /&gt; background: url(/admin/chooser-bg.gif) top center no-repeat;&lt;br /&gt; margin: 8em 3px 0 3px;&lt;br /&gt; padding: 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector-chooser li {&lt;br /&gt; margin: 0;&lt;br /&gt; padding: 3px;&lt;br /&gt; list-style-type: none;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector select {&lt;br /&gt; margin-bottom: 5px;&lt;br /&gt; margin-top: 0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector-add, .selector-remove {&lt;br /&gt; width: 16px;&lt;br /&gt; height: 16px;&lt;br /&gt; display: block;&lt;br /&gt; text-indent: -3000px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector-add {&lt;br /&gt; background: url(/images/admin/selector-add.gif) top center no-repeat;&lt;br /&gt; margin-bottom: 2px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector-remove {&lt;br /&gt; background: url(/images/admin/selector-remove.gif) top center no-repeat;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;a.selector-chooseall, a.selector-clearall {&lt;br /&gt; display: block;&lt;br /&gt; width: 6em;&lt;br /&gt; text-align: left;&lt;br /&gt; margin-left: auto;&lt;br /&gt; margin-right: auto;&lt;br /&gt; font-weight: bold;&lt;br /&gt; color: #666;&lt;br /&gt; padding: 3px 0 3px 18px;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;a.selector-chooseall:hover, a.selector-clearall:hover {&lt;br /&gt; color: #036;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;a.selector-chooseall {&lt;br /&gt; width: 7em;&lt;br /&gt; background: url(/images/admin/selector-addall.gif) left center no-repeat;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;a.selector-clearall {&lt;br /&gt; background: url(/images/admin/selector-removeall.gif) left center no-repeat;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.selector select {&lt;br /&gt;font-family:"Lucida Grande",Verdana,Arial,sans-serif;&lt;br /&gt;font-size:11px;&lt;br /&gt;font-weight:normal;&lt;br /&gt;}&lt;br /&gt;.selector h2 {&lt;br /&gt;margin-bottom:0; /*override dojo style*/&lt;br /&gt;}&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Form.html&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;&amp;lt;!--  Here ADMIN_MEDIA_PREFIX is path to django admin media --&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/core.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/getElementsBySelector.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/actions.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/SelectBox.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="{{ADMIN_MEDIA_PREFIX}}js/SelectFilter2.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="/{{MEDIA_URL}}/js/jsi18n.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;link  rel="stylesheet" type="text/css" href="/css/style.css" &amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;form action="." method="POST"&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{{form_as.table}}&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;button type="SUBMIT"&amp;gt;Submit&amp;lt;/button&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;ScreenShots.&lt;/span&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_9hUzwEjBH30/Spi9NDc-yYI/AAAAAAAAAGM/KCJRC2qFpWY/s1600-h/filter.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 111px;" src="http://1.bp.blogspot.com/_9hUzwEjBH30/Spi9NDc-yYI/AAAAAAAAAGM/KCJRC2qFpWY/s400/filter.png" alt="" id="BLOGGER_PHOTO_ID_5375254187229497730" border="0" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-3654950104728316638?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/3654950104728316638/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/08/reuse-django-admin-filteredselectmultip.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/3654950104728316638'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/3654950104728316638'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/08/reuse-django-admin-filteredselectmultip.html' title='Reuse Django Admin FilteredSelectMultiple Widget'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_9hUzwEjBH30/Spi9NDc-yYI/AAAAAAAAAGM/KCJRC2qFpWY/s72-c/filter.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-4116923934764273677</id><published>2009-06-29T10:50:00.000-07:00</published><updated>2010-11-04T00:37:06.843-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><title type='text'>Django Admin Change Default Filter</title><content type='html'>change the default filter choice from 'ALL'&lt;br /&gt;&lt;blockquote&gt;class MyModelAdmin(admin.ModelAdmin):   &lt;br /&gt;&lt;br /&gt;    def changelist_view(self, request, extra_context=None):&lt;br /&gt;&lt;br /&gt;        if not request.GET.has_key('decommissioned__exact'):&lt;br /&gt;&lt;br /&gt;            q = request.GET.copy()&lt;br /&gt;            q['decommissioned__exact'] = 'N'&lt;br /&gt;            request.GET = q&lt;br /&gt;            request.META['QUERY_STRING'] = request.GET.urlencode()&lt;br /&gt;        return super(MyModelAdmin,self).changelist_view(request, extra_context=extra_context)&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-4116923934764273677?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/4116923934764273677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/06/django-admin-change-default-filter.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/4116923934764273677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/4116923934764273677'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/06/django-admin-change-default-filter.html' title='Django Admin Change Default Filter'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-658976507251178555</id><published>2009-06-29T10:48:00.000-07:00</published><updated>2010-11-04T00:37:06.844-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><category scheme='http://www.blogger.com/atom/ns#' term='Python'/><title type='text'>Django url urldecode</title><content type='html'>import urllib&lt;br /&gt; &lt;br /&gt;def urldecode(query):&lt;br /&gt;   d = {}&lt;br /&gt;   a = query.split('&amp;')&lt;br /&gt;   for s in a:&lt;br /&gt;      if s.find('='):&lt;br /&gt;         k,v = map(urllib.unquote, s.split('='))&lt;br /&gt;         try:&lt;br /&gt;            d[k].append(v)&lt;br /&gt;         except KeyError:&lt;br /&gt;            d[k] = [v]&lt;br /&gt; &lt;br /&gt;   return d&lt;br /&gt; &lt;br /&gt;s = 'Cat=1&amp;by=down&amp;start=1827&amp;start=1234&amp;anotherCat=me%3Dow%7e'&lt;br /&gt;print urldecode(s)&lt;br /&gt;====================================================&lt;br /&gt;prints out following and preserves the order of inputs for those keys given more than once as with 'start' key&lt;br /&gt;{'start': ['1827', '1234'], 'anotherCat': ['me=ow~'], 'by': ['down'], 'Cat': ['1']}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-658976507251178555?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/658976507251178555/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/06/django-url-urldecode.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/658976507251178555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/658976507251178555'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/06/django-url-urldecode.html' title='Django url urldecode'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-6871996724029042448</id><published>2009-06-05T09:11:00.000-07:00</published><updated>2009-06-05T09:17:22.023-07:00</updated><title type='text'>Tropo</title><content type='html'>What is Tropo?&lt;br /&gt;&lt;br /&gt;Tropo is a new script-language focused API and deployment platform from Voxeo. Tropo's goal is to make it extremely easy for JavaScript, Ruby, Groovy, PHP and Python developers to create and deploy telephony and other communication applications.&lt;br /&gt;&lt;br /&gt;The current release of Tropo is similar to Google App Engine. You write scripts which drive our communications API.&lt;br /&gt;When you want to take or make calls, we run those scripts on servers in our cloud infrastructure. While running on our servers your scripts can use HTTP, web services, or other techniques to integrate with any other services or infrastructure.&lt;br /&gt;&lt;br /&gt;Creating Tropo Applications&lt;br /&gt;&lt;br /&gt;To implement a Tropo application, developers:&lt;br /&gt;    * Write a Tropo application in a supported scripting language&lt;br /&gt;    * Deploy their application on any web server&lt;br /&gt;    * Create a Tropo application at Tropo.com and link it to their script&lt;br /&gt;    * Test and debug their application using the application debugger&lt;br /&gt;&lt;br /&gt;Write a Tropo Application&lt;br /&gt;&lt;br /&gt;Tropo applications may be written in a number of supported scripting languages. At the time of launch, supported languages included:&lt;br /&gt;&lt;br /&gt;    * Ruby (.ruby, .truby, .rb, .trb)&lt;br /&gt;    * Python (.py, .tpy, .jython, .tjython, .jy, .tjy)&lt;br /&gt;    * Groovy (.groovy, .tgroovy, .gr, .tgr)&lt;br /&gt;    * PHP (.php, .tphp)&lt;br /&gt;    * JavaScript (.javascript, .js, .es)&lt;br /&gt;&lt;br /&gt;File extensions are used by Tropo to identify the interpreter that should be used to execute your script at runtime. Supported extensions are listed above along with their interpreter type. The "t" versions of the extensions are meant to prevent accidental execution of your script in some hosted environments. Remember, Tropo wants to execute your script on our telephony servers when a call is started!&lt;br /&gt;&lt;br /&gt;Deploy Your Application Script Files&lt;br /&gt;&lt;br /&gt;Once written, you must deploy the resulting script file to a web server of your choice. You may use your own web server, or you may choose to host your file on the Tropo web servers within Voxeo's data centers ("Tropo Hosted Scripts").&lt;br /&gt;&lt;br /&gt;If you choose to use Tropo web hosting for your files, you may upload and manage your files through the Tropo Hosted Scripts tools, or you may use our Tropo WebDAV Support to manage and edit your scripts directly from your favorite editor.&lt;br /&gt;&lt;br /&gt;Create the Tropo Application&lt;br /&gt;&lt;br /&gt;Go to Tropo.com and log into your account (create one if necessary). Once you log in, you will be presented with some Quick Links that allow you to manage your Applications, manage your Hosted Scripts, or review the Documentation. Choose "Applications" to setup an application linked to your script.&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 597px; height: 292px;" src="http://fluffer.wdfiles.com/local--files/tutorial:introduction/tropoquicklink.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-6871996724029042448?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/6871996724029042448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/06/tropo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/6871996724029042448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/6871996724029042448'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/06/tropo.html' title='Tropo'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-3998775356723320514</id><published>2009-05-15T03:00:00.000-07:00</published><updated>2010-11-04T00:37:06.844-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><title type='text'>Dynamic Image Upload Path- Django</title><content type='html'>&lt;span style="font-family:arial;"&gt;&lt;span style="font-weight: bold;"&gt;Introduction&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family:arial;"&gt;Simple way to implement dynamic image upload_to path based on object.&lt;/span&gt;&lt;span style="font-family:arial;"&gt;It is now possible for the &lt;/span&gt;&lt;code style="font-family: arial;"&gt;upload_to&lt;/code&gt;&lt;span style="font-family:arial;"&gt; parameter of the &lt;/span&gt;&lt;code style="font-family: arial;"&gt;FileField&lt;/code&gt;&lt;span style="font-family:arial;"&gt; or &lt;/span&gt;&lt;code style="font-family: arial;"&gt;ImageField&lt;/code&gt;&lt;span style="font-family:arial;"&gt; to be a callable, instead of a string. The callable is passed the current model instance and uploaded file name and must return a path.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-family:arial;"&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Models.py&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;blockquote&gt;class Books(models.Model):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     no=models.IntegerField()&lt;br /&gt;class Collection(models.Model):&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;     def imagepath(instance,filename):&lt;br /&gt;             &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;val="Book_Media/" + str(instance.Books.no)  + "/" + str(filename)&lt;br /&gt;             return val&lt;br /&gt;     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Page=models.ForeignKey('Books')&lt;br /&gt;     &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;image=models.ImageField(upload_to=&lt;span style="font-style: italic;"&gt;imagepath&lt;/span&gt;) &lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-weight: bold;"&gt;Description:&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;code style="font-style: italic;"&gt;&lt;/code&gt; &lt;span style="font-style: italic;"&gt;imagepath&lt;/span&gt; is the callable (in this case a function).  It simply gets the &lt;span style="font-style: italic;"&gt;'no&lt;/span&gt;' from the instance of &lt;code&gt;Books&lt;/code&gt; and uses that in the upload path.  Images will be uploaded to paths like:   &lt;span style="font-style: italic;"&gt;Book_Media/1/djano.jpg&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-3998775356723320514?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/3998775356723320514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/05/dynamic-image-upload-path.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/3998775356723320514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/3998775356723320514'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/05/dynamic-image-upload-path.html' title='Dynamic Image Upload Path- Django'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-3996366789240213011</id><published>2009-05-14T02:41:00.000-07:00</published><updated>2010-11-04T00:37:06.845-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax'/><category scheme='http://www.blogger.com/atom/ns#' term='Dojo'/><title type='text'>Django Ajax Form Submit - Dojo</title><content type='html'>&lt;p style="margin-bottom: 0cm;"&gt;&lt;b&gt;Introduction:&lt;/b&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;&lt;span style=""&gt;Simple&lt;/span&gt;&lt;b&gt; &lt;/b&gt;&lt;span style=""&gt; way to implement &lt;/span&gt;&lt;i&gt;&lt;span style=""&gt;Ajax&lt;/span&gt;&lt;/i&gt;&lt;span style=""&gt;  in &lt;/span&gt;&lt;i&gt;&lt;span style=""&gt;Django &lt;/span&gt;&lt;/i&gt;&lt;span style="font-style: normal;"&gt;&lt;span style=""&gt; with the help of &lt;/span&gt;&lt;/span&gt;&lt;a href="http://download.dojotoolkit.org/release-1.3.1/dojo-release-1.3.1.tar.gz"&gt;&lt;i&gt;&lt;span style=""&gt;Dojo&lt;/span&gt;&lt;/i&gt;&lt;/a&gt;&lt;span style="font-style: normal;"&gt;&lt;span style=""&gt; toolkit.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;&lt;b&gt;&lt;span style="font-style: normal;"&gt;1.Models.py&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span style=""&gt;Create  a model for &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=""&gt;Book&lt;/span&gt;&lt;/i&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;&lt;blockquote&gt;&lt;br /&gt;class Book(models.Model):&lt;div style="margin-left: 1cm;"&gt;name = models.CharField(max_length = 50)&lt;br /&gt;author = models.CharField(max_length = 60)&lt;br /&gt;year = models.IntegerField()&lt;br /&gt;ref_no =models.IntegerField()&lt;/div&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;2.&lt;/span&gt;&lt;b&gt;&lt;span style="font-style: normal;"&gt;Form.py&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;Create  a ModelForm for '&lt;/span&gt;&lt;i&gt;Book&lt;/i&gt;&lt;span style="font-style: normal;"&gt;'  Models&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;Write  a function for  save the details of '&lt;/span&gt;&lt;i&gt;Book&lt;/i&gt;&lt;span style="font-style: normal;"&gt;'&lt;/span&gt;&lt;/p&gt; &lt;/li&gt; &lt;blockquote&gt;&lt;br /&gt;class BookForm(ModelForm):&lt;br /&gt;      class Meta:&lt;br /&gt;            model=Book&lt;br /&gt;def AddBook(request):&lt;br /&gt;      if request.method == 'POST':&lt;br /&gt;            form=BookForm(request.POST)&lt;br /&gt;            if form.is_valid():&lt;br /&gt;                  form.save()# save Book&lt;br /&gt;                  return HttpResponse ("1")#if Book object stored, return confirmation.&lt;br /&gt;            else:&lt;br /&gt;                  return HttpResponse ("Please check the form data.")# if form validation failed&lt;br /&gt;      else:&lt;br /&gt;            form=BookForm()&lt;br /&gt;            return render_to_response("Register.html",{'Form':form})&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;3&lt;b&gt;&lt;span style="font-style: normal;"&gt;. Register.html&lt;/span&gt;&lt;/b&gt;&lt;p&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;Import  Dojo necessary packages to your html file&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;Import  Ajax.js where we are going to write the ajax function.&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;Div  'result' for show the  response(from form.py) after the form  submission.&lt;/span&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="/path_to_dojo/dojo-release-1.2.0/dojo/dojo.js" djConfig="parseOnLoad:true"&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript" src="ajax.js" &amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt; &amp;lt;div id=”result”&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt; &amp;lt;div id=”FormDiv”&amp;gt;&lt;br /&gt;  &amp;lt;form id="AddBook"&amp;gt;&lt;br /&gt;   {{Form}}&lt;br /&gt;  &amp;lt;/form&amp;gt;&lt;br /&gt;  &amp;lt;input type="submit" onclick="return ValidateBook();"&amp;gt;&lt;br /&gt; &amp;lt;div&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;&lt;span style=""&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-style: normal;"&gt;4.Ajax.js&lt;/span&gt;&lt;/b&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;Write  a function named as ValidateBook&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;Declare  a  variable 'kw'&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;Variable  'data' contains the response .&lt;/span&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;If  the Book details storeded in database, then form.py will return '1'  for confirmation &lt;/span&gt;  &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="font-style: normal;"&gt;If  Book details failed to validate , then error response will return.&lt;/span&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-bottom: 0cm;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;br /&gt;function ValidateBook()&lt;br /&gt;{&lt;br /&gt;var kw = {&lt;br /&gt;form: dojo.byId("AddBook"),&lt;br /&gt;url: "/book/add/",&lt;br /&gt;load: function(data){&lt;br /&gt;if (data==1)&lt;br /&gt;{&lt;br /&gt;dojo.byId("result").innerHTML="Book details has been registered successfully. ;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;dojo.byId("FormDiv").innerHTML=""&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;dojo.byId("test").innerHTML = data;&lt;br /&gt;}&lt;br /&gt;},&lt;br /&gt;error: function(data){&lt;br /&gt;console.debug("An error occurred: ", data);&lt;br /&gt;},&lt;br /&gt;timeout: 5000,&lt;br /&gt;form: "AddBook"&lt;br /&gt;};&lt;br /&gt;dojo.xhrPost(kw); //Servlet get argement with doPost&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/blockquote&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-3996366789240213011?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/3996366789240213011/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/05/django-ajax-submit-form.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/3996366789240213011'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/3996366789240213011'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/05/django-ajax-submit-form.html' title='Django Ajax Form Submit - Dojo'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-3319578800550350906</id><published>2009-05-07T01:02:00.000-07:00</published><updated>2009-05-07T01:54:19.273-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><category scheme='http://www.blogger.com/atom/ns#' term='xen'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Xen- Virtualization  Installation Ubuntu</title><content type='html'>&lt;style type="text/css"&gt;  &lt;!--   @page { size: 21cm 29.7cm; margin: 2cm }   P { margin-bottom: 0.21cm }  --&gt;  &lt;/style&gt;  &lt;p style="margin-bottom: 0cm; text-decoration: none; font-family: arial;"&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; font-family: arial;"&gt;Ubuntu is a great OS for use in both virtualisation hosts and in guest virtual machines and software appliances. Virtualization simply means the running of another OS within a &lt;strong&gt;host&lt;/strong&gt; OS, through the usage of a special "hypervisor" application which handles everything about how the guest OS operates within (and with) the host system&lt;/p&gt;  &lt;p style="margin-bottom: 0cm; text-decoration: none; font-family: arial;"&gt;&lt;b&gt;Disable Apparmor:            &lt;/b&gt; &lt;/p&gt; &lt;blockquote style="font-family: arial;"&gt;&lt;p&gt;/etc/init.d/apparmor stop&lt;br /&gt;update-rc.d -f apparmor remove&lt;/p&gt; &lt;/blockquote&gt; &lt;p  style="font-family:arial;"&gt;&lt;span style="text-decoration: none;"&gt;&lt;b&gt;Install XEN:&lt;/b&gt;&lt;/span&gt;  &lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;apt-get install ubuntu-xen-server   &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;After installation of xen you  should edit xorg.conf file.&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Update xorg configuration.vim  /etc/X11/ xorg.conf&lt;br /&gt;Your original  xorg.conf files looks&lt;br /&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;       Section "Device"&lt;br /&gt;        Identifier      "Configured Video  Device"&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;  Now add the following line  in xorg.conf&lt;br /&gt;&lt;blockquote&gt;&lt;p&gt;       Section "Device"&lt;br /&gt;        Identifier      "Configured Video  Device"&lt;br /&gt;        Driver          "i810"&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt;          &lt;span style="color: rgb(255, 0, 0);"&gt;Note&lt;/span&gt;: Here i810  refers to  graphics chipset.So check out your system graphics chipset.&lt;/li&gt;&lt;/ul&gt;&lt;p  style="margin-bottom: 0cm;font-family:arial;"&gt;&lt;br /&gt;&lt;span style="text-decoration: none;"&gt;&lt;b&gt;Download 2.6.24-16-xen kernel To avoid network problem: &lt;/b&gt;&lt;/span&gt; &lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;wget  http://www.il.is.s.u-tokyo.ac.jp/~hiranotaka/linux-image-2.6.24-16-xen_2.6.24-16.30zng1_i386.deb   &lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p  style="font-family:arial;"&gt;&lt;b&gt;&lt;span style="text-decoration: none;"&gt;Replace the Ubuntu 2.6.24-16-xen kernel:&lt;/span&gt; &lt;/b&gt; &lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;dpkg -i  linux-image-2.6.24-16-xen_2.6.24-16.30zng1_i386.deb   &lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;li&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Reboot your system&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p style="text-decoration: none; font-family: arial;"&gt;&lt;b&gt;Move tls file:&lt;/b&gt;&lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;mv /lib/tls /lib/tls.disabled   &lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="text-decoration: none; font-family: arial;"&gt;&lt;b&gt;Modify Modules: &lt;/b&gt; &lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Add the line in  vim  /etc/modules&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;loop max_loop=64&lt;/p&gt;&lt;/blockquote&gt;   &lt;p&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="text-decoration: none; font-family: arial;"&gt;&lt;b&gt;Directory for XEN:&lt;/b&gt;&lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;mkdir /home/xen   &lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="text-decoration: none; font-family: arial;"&gt;&lt;b&gt;Modify xen-tools.conf:&lt;/b&gt;&lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;vim /etc/xen-tools/xen-tools.conf   &lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;blockquote style="margin-left: 2cm; margin-right: 2cm; font-family: arial;"&gt;&lt;p&gt;install-method = debootstrap  # method will change with respect to type of OS&lt;br /&gt;dir = /home/xen&lt;br /&gt;dhcp = 1&lt;br /&gt;dist   = hardy                            # Type of guest os&lt;br /&gt;passwd = 1&lt;br /&gt;mirror = &lt;a href="http://192.168.1.36:9999/ubuntu/" target="_blank"&gt;http://192.168.1.36:9999/ubuntu/&lt;/a&gt; &lt;/p&gt;&lt;/blockquote&gt; &lt;ul&gt;&lt;li&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Reboot your system&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p  style="font-family:arial;"&gt;&lt;br /&gt;&lt;span style="text-decoration: none;"&gt;&lt;b&gt;Now Run &lt;/b&gt;&lt;/span&gt; &lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;jayapal@kcs:~$ uname -r&lt;br /&gt;2.6.24-16-xen   &lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p  style="font-family:arial;"&gt;&lt;span style="text-decoration: none;"&gt;&lt;b&gt;Create Guest OS:&lt;/b&gt;&lt;/span&gt; &lt;/p&gt;     &lt;style type="text/css"&gt;  &lt;!--   @page { size: 21cm 29.7cm; margin: 2cm }   P { margin-bottom: 0.21cm }  --&gt;  &lt;/style&gt;  &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;jayapal@kcs:~$ xen-create-image  --hostname=Guestos  --ide --passwd    &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="color: rgb(255, 0, 0);"&gt;Note&lt;/span&gt;: You can give size, swap,  Network settings, etc... to override settings in xen-tools.conf.&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;For more details   jayapal@kcs:~$ man xen-create-image   &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;After creating image file,Terminal  will show message as :   &lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;Logfile produced at:&lt;br /&gt;       /var/log/xen-tools/Guestos.log&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p style="text-decoration: none; font-family: arial;"&gt;&lt;b&gt;Guestos.cfg &lt;/b&gt; &lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;vim /etc/xen/Guestos.cfg&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-left: 1.25cm; margin-bottom: 0cm; font-family: arial;"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;kernel      = '/boot/vmlinuz-2.6.24-16-xen'&lt;br /&gt;ramdisk     = '/boot/initrd.img-2.6.24-16-xen'&lt;br /&gt;memory      = '128'&lt;br /&gt;vcpus       = '2'                   #For dual-core CPU&lt;br /&gt;root        = '/dev/hda2 ro'&lt;br /&gt;disk        = [&lt;br /&gt;         'tap:aio:/home/xen/domains/Guestos/swap.img,hda1,w',&lt;br /&gt;         'tap:aio:/home/xen/domains/Guestos/disk.img,hda2,w',&lt;br /&gt;         ]&lt;br /&gt;vif         = [ 'ip=192.168.2.10 mac=00:16:3E:C9:C2:6C' ]  &lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;&lt;/p&gt; &lt;p  style="font-family:arial;"&gt;&lt;br /&gt;&lt;span style="text-decoration: none;"&gt;&lt;b&gt;To start the virtual machine:&lt;/b&gt;&lt;/span&gt;&lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;xm create /etc/xen/Guestos.cfg&lt;br /&gt;Using config file  "/etc/xen/Guestos.cfg".&lt;br /&gt;Started domain Guestos   &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;xm console Guestos&lt;br /&gt;Guestos started and it will prompt for user login.   &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;To Stop the virtual machine:&lt;br /&gt;xm shutdown Guestos   &lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;for more command see xm man   &lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p  style="font-family:arial;"&gt;&lt;span style="text-decoration: none;"&gt;&lt;b&gt;For Centos:&lt;/b&gt;&lt;/span&gt;  &lt;/p&gt; &lt;ul style="font-family: arial;"&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Download initrd.img and vmlinuz,  then move in to /boot/ directory   &lt;/p&gt;  &lt;blockquote&gt; &lt;p style="margin-bottom: 0cm;"&gt;wget  http://mirror.centos.org/centos/5/os/i386/images/xen/initrd.img&lt;br /&gt;wget  http://mirror.centos.org/centos/5/os/i386/images/xen/vmlinuz   &lt;/p&gt;  &lt;/blockquote&gt; &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Mirror   &lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;blockquote style="margin-left: 2cm; margin-right: 2cm; font-family: arial;"&gt;&lt;a href="http://mirror.centos.org/centos/5/os/i386/images/xen/" target="_blank"&gt;http://mirror.centos.org/centos/5/os/i386/images/xen/&lt;/a&gt; &lt;/blockquote&gt; &lt;p style="font-family: arial;"&gt;&lt;b&gt;Source:&lt;/b&gt;  &lt;/p&gt; &lt;blockquote style="font-family: arial;"&gt;&lt;a href="http://www.howtoforge.com/ubuntu-8.04-server-install-xen-from-ubuntu-repositories" target="_blank"&gt;http://www.howtoforge.com/ubuntu-8.04-server-install-xen-from-ubuntu-repositories&lt;/a&gt; &lt;/blockquote&gt; &lt;p style="margin-bottom: 0cm; font-family: arial;"&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm; font-family: arial;"&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-3319578800550350906?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/3319578800550350906/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/05/xen-virtualization-installation-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/3319578800550350906'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/3319578800550350906'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/05/xen-virtualization-installation-ubuntu.html' title='Xen- Virtualization  Installation Ubuntu'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-6634895916661037697</id><published>2009-04-29T23:48:00.000-07:00</published><updated>2010-11-04T00:37:06.845-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><title type='text'>DjangoAudit</title><content type='html'>&lt;style type="text/css"&gt;  &lt;!--   @page { size: 21cm 29.7cm; margin: 2cm }   P { margin-bottom: 0.21cm }  --&gt;  &lt;/style&gt;  &lt;p style="margin-bottom: 0cm; font-weight: bold;"&gt;Procedure:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Download audit file and save  inside your project application folder.&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Edit models file&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-left: 1.25cm; margin-bottom: 0cm;"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;from django.db import models&lt;br /&gt;import audit&lt;br /&gt;&lt;br /&gt;class Person(models.Model):&lt;br /&gt;first_name = models.CharField(max_length=255)&lt;br /&gt;last_name = models.CharField(max_length=255)&lt;br /&gt;salary = models.PositiveIntegerField()&lt;br /&gt;history = audit.AuditTrail()&lt;br /&gt;&lt;br /&gt;def __str__(self):&lt;br /&gt;return "%s %s" % (self.first_name, self.last_name)&lt;br /&gt;&lt;/p&gt; &lt;/blockquote&gt; &lt;p&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;If you need to view the audit  information in the admin interface, simply add show_in_admin=True as  an argument to AuditTrail.&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Then run python manage.py sncdb in  terminal to take effect&lt;br /&gt;&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-bottom: 0cm; font-weight: bold;"&gt;Testing:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Test1View.py&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;&lt;blockquote&gt;&lt;p&gt;from myapp.models import Person&lt;br /&gt;&lt;br /&gt;person = Person.objects.create(first_name='Jayapal', last_name='D', salary=50000)&lt;br /&gt;person.history.count()&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/blockquote&gt;&lt;p style="margin-left: 1.25cm; margin-bottom: 0cm;"&gt;&lt;/p&gt;&lt;p style="margin-left: 1.25cm; margin-bottom: 0cm;"&gt;&lt;/p&gt;&lt;p style="margin-left: 1.25cm; margin-bottom: 0cm;"&gt;OutPut:&lt;/p&gt; &lt;p style="margin-left: 1.25cm; margin-bottom: 0cm;"&gt;1&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Test2View.py&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;blockquote&gt;&lt;p&gt;from myapp.models import Person&lt;br /&gt;&lt;br /&gt;person = Person.objects.create(first_name='Jayapal', last_name='D', salary=50000)&lt;br /&gt;person.salary = 65000&lt;br /&gt;person.save()&lt;br /&gt;for item in person.history.all():&lt;br /&gt;&lt;span style="margin-left: 1.25cm;"&gt;print "%s: %s" % (item, item.salary)&lt;/span&gt;&lt;br /&gt;person2 = Person.objects.create(first_name='Sahab', last_name='Husain', salary=50000)&lt;br /&gt;print "count:", person.history.count()&lt;br /&gt;print "count of person2:",person2.history.count()&lt;br /&gt;print "total count in table Person:",Person.history.count()&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;/blockquote&gt; &lt;p style="margin-left: 1.25cm; margin-bottom: 0cm;"&gt;OutPut:&lt;/p&gt; &lt;p style="margin-left: 1.25cm; margin-bottom: 0cm;"&gt;Jayapal D as of 2007-08-14 20:31:21.852000: 65000&lt;br /&gt;Jayapal D as of 2007-08-14 20:30:58.959000: 50000&lt;br /&gt;count: 2&lt;br /&gt;count of person2: 1&lt;br /&gt;total count of table Person: 3&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Tracking Information:&lt;br /&gt;As you  can see, the audit trail is listed with the most recent state first.  Each entry also inclues a timestamp when the edit took place. Saves  and deletes are both tracked, and can be filtered on via  Person.history.filter(_audit_change_type='_') . Do not use  underscore, use 'I' for inserts, 'U' for updates, and 'D' for  deletes. ForeignKeys? and OneToOneFields? are now supported both for  saving and accessing the audit data. However, it does not archive  the contents of the ForeignKey? table for the appropriate entries at  the same time, and will fail if the ForeignKey? a given audit entry  is related to is deleted (including if you're auditing the  ForeignKey? table as well, it does not have a way to link the two  audit tables together).&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-bottom: 0cm;"&gt;For More information Audit+Wiki&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-6634895916661037697?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/6634895916661037697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/04/djangoaudit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/6634895916661037697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/6634895916661037697'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/04/djangoaudit.html' title='DjangoAudit'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-6230983976523367206</id><published>2009-04-29T00:52:00.000-07:00</published><updated>2010-11-04T00:37:06.846-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><title type='text'>Django DebugToolbar</title><content type='html'>&lt;style type="text/css"&gt;  &lt;!--   @page { size: 21cm 29.7cm; margin: 2cm }   P { margin-bottom: 0.21cm }  --&gt;  &lt;/style&gt;  &lt;p style="margin-bottom: 0cm;"&gt;&lt;a name="goog-ws-page-title-header"&gt;&lt;/a&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;The Django Debug Toolbar is a configurable set of panels that display various debug information about the current request/response and when clicked, display more details about the panel's content.&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;Currently, the following panels have been written and are working:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Django version&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Request timer&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;A list of settings in settings.py&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Common HTTP headers&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;GET/POST/cookie/session variable  display&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Templates and context used, and  their template paths&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;SQL queries including time to  execute and links to EXPLAIN each query&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Cache stats&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Logging output via Python's  built-in logging module&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-bottom: 0cm;"&gt;&lt;a name="goog-ws-page-title-header1"&gt;&lt;/a&gt; &lt;b&gt;Download&lt;/b&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;DebugToolbar or see for &lt;a href="http://github.com/robhudson/django-debug-toolbar/tree/master/README.rst#"&gt;latest  source code&lt;/a&gt;&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Copy folder in your python  site-packages path (/usr/lib/python2.5/site-packages/debug_toolbar&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-bottom: 0cm;"&gt;&lt;b&gt;Implementation&lt;/b&gt;&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Edit your project settings.py file&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;blockquote&gt;&lt;p style="margin-bottom: 0cm;"&gt;DEBUG = True&lt;br /&gt;MIDDLEWARE_CLASSES = ('debug_toolbar.middleware.DebugToolbarMiddleware',)&lt;br /&gt;INSTALLED_APPS = ('debug_toolbar',)&lt;br /&gt;INTERNAL_IPS = ('127.0.0.1',)&lt;br /&gt;DEBUG_TOOLBAR_PANELS = (&lt;br /&gt;'debug_toolbar.panels.version.VersionDebugPanel', 'debug_toolbar.panels.timer.TimerDebugPanel', 'debug_toolbar.panels.settings_vars.SettingsVarsDebugPanel', 'debug_toolbar.panels.headers.HeaderDebugPanel', 'debug_toolbar.panels.request_vars.RequestVarsDebugPanel', 'debug_toolbar.panels.template.TemplateDebugPanel', 'debug_toolbar.panels.sql.SQLDebugPanel', 'debug_toolbar.panels.cache.CacheDebugPanel', 'debug_toolbar.panels.logger.LoggingPanel',&lt;br /&gt;)&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Run your project and see django  toolbar in template.&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;b&gt;Screen Shots&lt;/b&gt;&lt;/p&gt;&lt;i&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="color: rgb(204, 0, 0);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/i&gt;&lt;h3 xmlns="http://www.w3.org/1999/xhtml" id="goog-ws-page-title-header" class="goog-ws-page-title" style="font-family: georgia;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://sites.google.com/site/djangoframework/_/rsrc/1225858959404/debugtoolbar/ToolBarPic.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 700px; height: 31px;" src="http://sites.google.com/site/djangoframework/_/rsrc/1225858959404/debugtoolbar/ToolBarPic.png" alt="" border="0" /&gt;&lt;/a&gt;&lt;/h3&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-6230983976523367206?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/6230983976523367206/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/04/django-debugtoolbar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/6230983976523367206'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/6230983976523367206'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/04/django-debugtoolbar.html' title='Django DebugToolbar'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2299763478272042075.post-5183908837979603301</id><published>2009-04-28T04:37:00.000-07:00</published><updated>2010-11-04T00:37:06.846-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Django'/><title type='text'>Django and mod_wsgi: A perfect match!</title><content type='html'>&lt;style type="text/css"&gt;  &lt;!--   @page { size: 21cm 29.7cm; margin: 2cm }   P { margin-bottom: 0.21cm }  --&gt;  &lt;/style&gt;  &lt;p style="margin-bottom: 0cm;"&gt;&lt;a name="goog-ws-page-title-header"&gt;&lt;/a&gt; &lt;b&gt;Introduction&lt;/b&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;mod_wsgi is an Apache module for serving WSGI-based Python web applications from the Apache HTTP server. Django, along with almost every other Python web framework today, comes bundled with a backend for acting like a WSGI application. Discovering and trying out mod_wsgi really suprised me. It can take a massive beating, and outperforms mod_python in every practical aspect.&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;&lt;b&gt;The setup&lt;/b&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;You will need a short Python "bootstrap" script to create a WSGI-handler for your Django project. Here is an example (call it wsgi_handler.py and place it in the root directory of your Django project - the one with manage.py and settings.py):&lt;/p&gt; &lt;blockquote&gt;&lt;p&gt;import sys&lt;br /&gt;import os&lt;br /&gt;import django.core.handlers.wsgi&lt;br /&gt;sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/..')&lt;br /&gt;os.environ['DJANGO_SETTINGS_MODULE'] = 'projectname.settings'&lt;br /&gt;application = django.core.handlers.wsgi.WSGIHandler()&lt;br /&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Apache virtualhost to use mod_wsgi&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-bottom: 0cm;"&gt;&lt;span style="margin-left: 1.25cm;"&gt;Add the below lines before the endof virtualhost close tag in apache config file&lt;/span&gt;  &lt;/p&gt;&lt;blockquote&gt;&lt;p style="margin-bottom: 0cm;"&gt;WSGIScriptAlias / /home/user/projectname/wsgi_handler.py&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;WSGIDaemonProcess projectname user=user group=user processes=1 threads=10&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;WSGIProcessGroup projectname&lt;/p&gt; &lt;/blockquote&gt;&lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Restart apache to take effect.&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;In the WSGIDaemonProcess line, you  can easily manage the amount of system resources (measured in  processes and threads) mod_wsgi should use. In my experience a  single process with 10 threads will cover most small and medium  loaded websites.&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;b&gt;Why?&lt;/b&gt;&lt;/p&gt; &lt;p style="margin-bottom: 0cm;"&gt;This is some of the reasons why you should ditch mod_python for mod_wsgi when hosting Django projects:&lt;/p&gt; &lt;ul&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Faster&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;p style="margin-bottom: 0cm;"&gt;The load times of the websites now  served with mod_wsgi really surprised me. Normally a page would be  served within 150-300 ms. This was reduced to load times in the  range of 40-80 ms.&lt;/p&gt;&lt;p style="margin-bottom: 0cm;"&gt;I also discovered that running  mod_wsgi in embedded mode (as opposed to daemon mode) was not worth  the effort. I didn't really see any difference between load times  when using Django.&lt;/p&gt;&lt;p style="margin-bottom: 0cm;"&gt;&lt;/p&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Less memory usage&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;Everyone hosting more than a couple of  Django projects on a single Apache instance knows that Django  projects squanders a bit with memory usage, and every single Apache  child process will easily end up using 50 MB RAM.&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;mod_wsgi dedicates a process (or  multiple processes) to a single interpreter for a single Django  project, and keeps the memory usage low in the "normal"  Apache child processes. On a server with 8 small Django projects, I  went from using ~1500 MB RAM on Apache child processes to using 150  MB.&lt;/p&gt;  &lt;/li&gt;&lt;li&gt;&lt;p style="margin-bottom: 0cm;"&gt;Secure&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;When using mod_python your Python  interpreter will be running as the user running the Apache webserver  itself (on Debian systems, the user is called www-data). Typically  this will allow you to peek around in places where you do not want  your users peeking. This is due to the fact that www-data must have  read access to every file you use in your application (including  settings/configuration/media files).&lt;/p&gt;  &lt;p style="margin-bottom: 0cm;"&gt;mod_wsgi addresses this problem by  changing to a user id specified in the configuration file, and run  your Python interpreter as another user than www-data, allowing you  to lock down every project on your server to seperate user accounts.&lt;/p&gt; &lt;/li&gt;&lt;/ul&gt; &lt;p style="margin-bottom: 0cm;"&gt;These points cover mod_wsgi running in daemon mode&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2299763478272042075-5183908837979603301?l=jayapal-d.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jayapal-d.blogspot.com/feeds/5183908837979603301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://jayapal-d.blogspot.com/2009/04/django-and-modwsgi-perfect-match.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/5183908837979603301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2299763478272042075/posts/default/5183908837979603301'/><link rel='alternate' type='text/html' href='http://jayapal-d.blogspot.com/2009/04/django-and-modwsgi-perfect-match.html' title='Django and mod_wsgi: A perfect match!'/><author><name>jayapal</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/_9hUzwEjBH30/TNJcFxJFLVI/AAAAAAAAAZg/CPNxb3F_HXs/S220/DSC01348.JPG'/></author><thr:total>0</thr:total></entry></feed>
