Sunday, September 14, 2008

Django Editor

2008-09-14:

UliPad 3.9
* tried UliPad 3.9 tonight, and so far liking it! (for my Django projects that is)
* http://code.google.com/p/ulipad/

UliPad 3.9 Good So Far:
* syntax highlighting specially for Django templates
* auto-completion
* folding
* zoom-in or zoom-out editor window
* lightweight on memory
* cross-platform
* code snippets
* directory browser (sort of project browser) 
* multi-view support

UliPad 3.9 Bad So Far:
* error opening "error log" when in Windows XP limited user account (which was easily fixed by installing UliPad to a directory where the limited user has read-write privileges) 


EasyEclipse for Python 1.3.1

* I have been using EasyEclipse for Python as my Django editor for the past 4 months now. (but will be replaced by UliPad nowadays)
* http://www.easyeclipse.org/site/home/

EasyEclipse for Python 1.3.1 Good So Far:
* support for projects (creation, opening, closing)
* syntax highlighting for python, html, css
* auto-indent
* auto-completion (some)
* creation of python projects and files

EasyEclipse for Python 1.3.1 Bad So Far:
* no zoom-in or zoom-out of editor window (you can't make the texts larger or smaller)
* no syntax highlighting for django templates
* very minimal support for auto-completion
* heavyweight on memory
* haven't found the code snippets tool

Btw, I have tried using Notepad++ but since it is not cross-platform, I went back to EasyEclipse for Python.  I occasionaly use it as text editor though.

Labels: , ,

Thursday, July 31, 2008

Django 0.96 and 1.0 alpha

The web framework for perfectionists with deadlines.
Django makes it easier to build better Web apps more quickly and with less code.

These notes refer to Django version 0.96 and 1.0 alpha:

2008-08-26:
GREAT so far:
* model-db-tables creation
* template inheritance
* great documentation
* fixtures

PROBLEMS so far:
* creating CRUD forms
* upgrading models sometimes requires going to the rdbms admin software to alter or drop the table
* console commands to administer, validate, reset, etc

2008-08-25:
* generic views:
* edit urls.py
* (r'^incomes/list/$', 'imbr.incomes.views.income_list'),
* edit views.py:
* return an object_list()
* edit models.py:
* create a ModelForm for your models

* django generic wrapper howto: http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/
* django.views.generic.list_detail.object_list has "object_list" as the name of the variable for use on your templates. This is overridable.
* django.views.generic.list_detail.object_detail has "object" as the name of the variable for use on your templates. This is overridable.

2008-08-13:
* use babel, http://babel.edgewall.org, a Python library for I18N and L10N - use BabelDjango for your django projects
* to round-off decimals at django templates use the floatformat filter (ie 34.23234 --> {{ value|floatformat:3 }} --> 34.232)

2008-06-16:
* to use alternating rows, use CYCLE, make sure not to put spaces between the values, only commas.

2008-06-11:
* iif() equivalent == (c and (a,) or (b,))[0] from http://mail.python.org/pipermail/python-list/2001-June/090770.html

2008-06-04:
* in postgresql, an error in adding data will occur if database is prepopulated by data from fixtures. Use "python manage.py sqlsequencereset catalog | psql -U postgres -d lms" after loading your fixtures. Issue Ticket is http://groups.google.com/group/django-users/msg/7df2011a3700c3d0

2008-06-02:
* fixtures as json are much easier to maintain: add, edit, and remove records
* to save data as fixtures: python manage.py dumpdata --format=json --indent=4 catalog > catalog/initial_data.json
* to load data as fixtures: python manage.py loaddata catalog/initial_data.json
* use fixtures to add initial data to your database
* use unittest as unit tests for your models

2008-05-30:
* http://www.stonemind.net/blog/2007/01/12/small-django-tips-from-one-newbie-to-another/

2008-05-28 (chapter 7):
* redirect after POST to prevent saving duplicate record

2008-05-26 (chapter 7):
* escape variables in your templates to prevent XSS

2008-05-26 (chapter 5):
* for "python manage.py dbshell" to work under sqlite3 db, download the sqlite3.exe executable from www.sqlite.org and put it somewhere in your path
* put __str__() method to all model classes for a string representation of the class
* use PIL (python imaging library) for ImageFields in your model at http://www.pythonware.com/products/pil/
* django requires single column primary key
* django uses the MTV (model-template-view) framework. In MVC framework, Model = django.model, View = django.views and django.templates, Controller = django.URLconfs

2008-05-25: (chapter 4)
* Template inheritance can be nested to whatever level
* Templates are the Views in MVC model
* Templates have their own language but just enough for "presentation" level, if you want to add logic, use a View
*

Labels: , ,