Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Hacking Django forms for CSS flexibility
The default output of the Django forms (former newforms) module is not very CSS friendly. With a few simple adjustments, you can make your web designer colleague happy. This patch will add three classes on the parent HTML element of the rendering of each form field (the tr, li or p tag depending on your rendering mode): The type of the form field. (Examples: CharField, ModelChoiceField) The type of the widget. (Examples: TextInput, SelectInput) Is the form field optional or required: Optional or Required Now a required DateField will render, using the as_table rendering, as: 1 <tr class="DateField TextInput Required"> 2 <th> 3 <label for="id_date">Date</label> 4 </th> 5 <td> 6 <input type="text" name="date" id="id_date" /> 7 </td> 8 </tr> Example uses A couple of example use cases where my patch will help you out: Special styling of required fields possible. Easier to add a date picker by JavaScript. Special styling of checkboxes (styling input elements to width: 100% also affects those). Download the patch Patch against forms/forms.py in Django 1.0: Download - View How to patch your newly downloaded Django-1.0.tar.gz For those of you not quite familiar with working with patches: $ wget http://www.hacktheplanet.dk/export/HEAD/misc/forms.py.patch $ wget http://www.djangoproject.com/download/1.0/tarball/ $ tar xvfz … -
Django ModelForm - replacement for form_for_model & form_for_instance
Each commit, Django gets more amazing.I wrote about newforms library before. The library was a big step in Django form displaying and validating.The first approach was to use forms.form_for_model() and forms.form_for_instance() respectively.As Django programmer I found this a little confusing. Both were similar. The only difference was that form_for_instance() took an object instance for saving -
Custom Actions In Django Admin Object Editor
I’ve seen many posts asking for the simplest feature in Django admin… the ability to add custom actions next to History and View On Site in the Django admin form. The page where the actual object is edited, not the list pages. Imagine adding actions like: Edit Next Item Edit Previous Item Send Thank You Email Export [...] -
Warsztaty Django
Marcin Kaszyński organizuje w Warszawie warsztaty Django. Będzie można na nich dowiedzieć się od podstaw jak działa Django i co w nim siedzi. Warsztaty są skierowane dla ludzi niezorientowanych w tej technologi, ale również dla tych, co robią już pierwsze kroki. Jedyne wymaganie, to... -
Django -> Plone: Portlets, Viewlets, Zcatalog, Aspects
[Another in a series of posts about moving from Django to Plone. I'm a Plone/Zope newbie writing about my bafflements and enlightenments as they happen. Some of my opinions are certainly wrong. I'm writing this in the expectation that the history of my meandering learning path may be useful, or at least entertaining, to future Plone [...] -
Django browser for Redmine database
Do you know redmine ? This is, to my knowledge, the best project manager you could ever find out there. I like to describe it as ‘trac done well‘. It has only one, big, ugly, fat inconvenient for me : it is written on top of ruby on rails. I could tell you how slow [...] -
Django JQuery Autocomplete for Model Selection
I’ve been working on a very cool snippet, inspired by Django Autocomplete Widget : http://www.djangosnippets.org/snippets/233/ The idea is to create a Widget containing the client side code (I mean html + jquery), and a custom field called ModelAutocompleteField that accepts any model as a contructor parameter and its clean method returns the instance selected by [...] -
Django Diário is now compatible with Django 1.0
Diário weblog application for Django is now compatible with Django 1.0. After release candidate 1, Diário was broken because of comments refactoring. Apparently, everything works fine. Special thanks to Rodrigo Pimentel to open an issue for this and for sending patch. Now is close the eternal issues. :-P -
Zapowiedź Django 1.1
Pojawiła się już informacja o przyszłej wersji Django. Nie wyjdzie ono szybko, bo dopiero w marcu przyszłego roku. Terminy nowej wersji: Version1.1Roadmap Lista nowych rzeczy.Version1.1Features Ma pojawić się sporo nowości. Można zauważyć, że większość rzeczy, które mają się... -
django and some plone
There seems to be some rumblings on the Plone front for us currently. For our main stable of development however, we have moved away although not totally from Plone to django. The main reason here is that for Plone deals to be feasible for us, we either have to:1. Lock requirements down really tight so that the juniors can have a go at it .... or 2. Sic some seniors at it.In my own experience, it seems that while Plone can be easy if worked within a tight parameter, try swaying a bit out of those parameters, when you have to peer under the hood and you are in a world of pain. It's hard to gain leverage using Plone this way. django on the hand has been actually quite young developer friendly for us and they end up being actually more productive compared to when they are forced to make some funky changes in Plone. Most of the business applications that we build require a light framework and is normally built from ground up. This means that Plone is sometimes an overkill for these apps which is a shame because Plone almost always appear like a good fit in … -
Aplikacja napisana w Django zajęła pierwsze miejsce!
Aplikacja napisana w Django zajęła pierwsze miejsce w konkursie Hackfest. Pierwsza trójka wygląda następująco: 1. Megakozak - 18,99 % głosów 2. True Solutions (muu.sk*) - 15,86 % głosów 3. Speedsoft (Nastrojometr) - 13,9 % głosów Twórcom gratulujemy wygranej i życzymy dalszych... -
MVC en .Net – Primeras Impresiones
Bueno hace mucho tiempo que queria iniciar un blog y que mejor manera de iniciarlo que hablando de nuestro nunca bien ponderado .Net. Nunca he sido fanático ni seguidor de las tecnologías de Microsoft pero tampoco las satanizo. Luego de haber desarrollado algunas aplicaciones, tratando de aplicar algunas buenas prácticas en el desarrollo, siento que [...] -
10. Finishing the Code-Sharing Application
This is part 10 of a series of posts on James Bennett's excellent Practical Django Projects. The table of contents and explanation can be found here Finally, we're on the home stretch. This chapter builds on our knowledge of templates and also gives a few new examples of custom template tags, so without further ado lets finish the app. On p188 you need to modify the save method of the bookmark -
9. Form Processing in the Code-Sharing Application
This is part 9 of a series of posts on James Bennett's excellent Practical Django Projects. The table of contents and explanation can be found here The chapter is the first serious coverage of forms. As Django 1.x has been released there is no old and newforms just forms, so on p171 and p176 and wherever else from django import newforms as forms is used, just use from django import forms. There -
Mark Ramm: Django and learning from Zope 2
Mark Ramm gave an interesting talk (now up on youtube) at DjangoCon about learning from the experiences of Zope 2. As someone who hit the Z productivity wall after developing a site with Zope 2 I really appreciated what he had to say but disagree with the reasons for the decline of Zope 2 and what it means for Django. The first part of the talk he summarizes as:"basically an argument that -
Django Tabbed Admin
A while ago i was playing with the excellent pinax (django-hotclub) project and i felt like the admin index page was kind-of overwhelming due to all the different apps listed in it. So i put a simple app together that has one template tag and a slight modification of the "admin/index.html" template to create simple tabs in the django admin interface. To minimize my effort ;-) i used jquery and ui.tabs.js to create the tabs at runtime. With one mandatory tab called "main" (changeable in settings.py), which contains all apps not mapped to a specific tab, and an attribute in settings called "ADMIN_TABS" that maps different apps to different tabs. It's still more-or-less a proof-of-concept applicatio, but it shows how easy these kinds of modifications can be in the django admin interface. Screenshots Mercurial repository Afterthoughts: I would like to extend this to something like shown in the Gondola screencast by Peter Baumgartner at a later time where a specific tab can also short-cut to common usage patterns. -
Django -> Plone: Light Bulbs, differences, irks
[This continues from my first post about my Django-to-Plone odyssey.] I now understand more of Plone‘s underlying concepts. I can’t yet create a non-trivial Plone site from scratch in a reasonable amount of time, but I’m getting closer. I’ve read some of, and have temporarily put aside, Professional Plone Development. I’ve read a few of the on-line tutorials [...] -
Simplifying Django Template Extensions
Simplifying Django Template Extensions -
DjangoCon Sessions: Video
The DjangoCon sessions are now up on YouTube. -
DjangoCon Sessions: Video
The DjangoCon sessions are now up on YouTube. -
DjangoCon Sessions: Video
The DjangoCon sessions are now up on YouTube. -
8. A Social Code-Sharing Site
This is part 8 of a series of posts on James Bennett's excellent Practical Django Projects. The table of contents and explanation can be found here Building and testing the models for the snippets app is fairly straightforward. The only changes you need to make are to separate out your admin classes into the separate admin.py file which I've shown previously, so type up all the code up to p154 -
4. A Django-Powered Weblog
Creating the Weblog Application This is part 4 of a series of posts on James Bennett's excellent Practical Django Projects. The table of contents and explanation can be found here. Before we start going through the Weblog app, you may want to have a look at my post on Django tests. This will help sort out any basic errors you make typing up examples. In this section of the book James gives -
Gotchas about Fixtures for Initial Data
One part of Django testing environment is fixtures. They are pre-prepared datasets to fill into the database before running tests. Django uses a separate database for running tests, but the fixtures from the files initial_data.* are also loaded into the main database when you synchronize it.I make fixtures for my application like this:python manage.py dumpdata --format=json --indent=4 myapp > apps/myapp/fixtures/initial_data.json The initial data is read out from apps/myapp/fixtures/initial_data.json and written to the main or the test database when I synchronize the databasepython manage.py syncdbor when I run the testspython manage.py test myappFixtures are great for deploying standard data like predefined categories, lists of countries and languages, default flatpages, default navigation, default user groups, and so on. However, you should be very cautious with them while developing.When I create new models, it's common practice to me to sync db so that the new database tables are created and the database schema reflects the models. Just after creation of new tables all fixtures called initial_data from all applications will be loaded. N.B. The fixtures from initial_data overwrite all existing data while synchronizing database. So if you have some important data that differs from the defaults, better make some database backup before syncing … -
Atualizando projetos para Django 1.0
Fiquei bastante sumido durante as duas últimas semanas. Estou me dedicando em adaptar alguns projetos para o Django 1.0, versão muito esperada que foi lançada recentemente. Por serem projetos de produção, optei por sempre respeitar e seguir as versões estáveis do Django, mesmo sabendo que existe um comprometimento grande por parte dos desenvolvedores em relação a estabilidade e segurança das versões em SVN. Em laboratório, mantenho as duas versões (a estável e a SVN, utilizada para testar novas features e avaliar as melhorias). O bom de fazer essa atualização de código é aproveitar a oportunidade e colocar em prática um ‘code refactoring‘, otimizando as aplicações e aproveitando a oportunidade para corrigir bugs e padronizar diversas funções. O Django 1.0 tem várias novidades e muda muita coisa em relação ao 0.96, por isso nem sempre um código feito para a versão 0.96 vai funcionar de primeira na 1.0, mas a adaptação vale a pena, pois a nova versão está sensacional. Como eu já estava acompanhando as evoluções através do SVN, a migração não está sendo difícil porque já sei tudo que mudou, mas no meu caso é demorada porque diversos pontos das aplicações que mantenho são complexas e dependem de outras …