Friday, February 18, 2011

Why You should give a chance to django? Pt 2


I've looked a little more deep into django and i found it very flexible, You can do almost anything with the template engine. It's like the SMARTY template engine for php but it's much more not like it. It's so flexible that you can load templates from anywhere you want including zip files, SVN or database.

Templating allows you to do inheritance from another template. You can create non redundant code templates by that. It's even easier for you're web artist to cut graphics and  make everything quicker. This is done thanks to blocks. you can name a block and give it a constant text if that block will not be implemented in the child template it will display that text, otherwise it will be filled with the child data. That's a major help for creating display/edit generic forms.

You can write Your own tags with such light code that's it is almost impossible, next week i will give you a svn with some sample that i will try to develop. You have basic if's, for's tags and so on but the filters for variables are very helpful. For example a filter can add " 's" according to the count of results from database response. It's probably eazy to make it multilingual, especially that everything is encoded in unicode and help with i18n.

If my hosting with crazy SZATAN (translates to satan) system gives me privilege of running django remotely i will run a remote sample of django. I will be happy if you consider hacking it because i want to know where i'm thinking wrong. Don't do nothing to the hosting provider because he won't be so forgiving as me. (by hacking that instance you will have no legal problems because i give you the green light)

I've read some tips and tricks on the views and urlconfs that i won't describe here because it's not so important but still the flexibility is astonishing. The best thing i saw today were inclusions tags. It's like you can use a template inside a template so You can template while You're templating. It's really helpful (and funny, but it breaks the loose coupling law). Till monday i think i'll end that book and go to some practice. On monday my broadband will be back so finally i can download all without pain.

Till then.

No comments:

Post a Comment