Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Formulários elegantes com Django
Não poupo críticas ao Django, este excelente framework em Python tem me ajudado a concluir todos meus projetos relacionados a web, se tornou o padrão de desenvolvimento da Trianguli, empresa onde trabalho. O lema do Django “The web framework for perfectionists with deadlines” faz muito sentido e tem auxiliado muito a Trianguli a cumprir seus deveres para com seus clientes. Confesso que nunca gostei muito dos módulos de formulários (forms) do Django, sempre optei em fazer meu formulários na mão para adapta-los melhor ao layout e não correr riscos de ter algum resultado inesperado de layout, mas os formulários são uma mão na roda para validação e até melhorar a segurança do site. Outro dia estava realizando uma pesquisa rotineira e acabei encontrando o Uni-Form, um conjunto de CSS e JavaScript (depende do jQuery) que cria formulários de uma maneira mais elegante, incluindo sua validação. O Uni-Form é altamente personalizável e seu código está muito bem elaborado e validado via W3C. Pesquisando mais um pouco, encontrei o django-uni-form, que faz a integração do Uni-Form ao Django, permitindo seu uso rapidamente em um projeto Django existente, com poucas modificações no código. O django-uni-form pode substituir o modelo de formulários do Django … -
A Civilized Way Display Lots Of Data
Django is a civilized way to build web applications. Pagination is a civilized way to display lots of data. There are still people developing websites with tens of thousands of items crammed in a single page. Even if you use JavaScript to paginate client-side, never ending download results in poor user experience. Django has pagination [...] -
Primeros pasos con geodjango
Este es un minitutorial "expreso" para probar geodjango en debian testing con postgres 8.3, postgis y django 1.1Pues lo primero es instalar los "juguetes":$ apt-get install postgis postgresql-8.3 postgresql-plpython-8.3 $ apt-get install python2.5 python-psycopg2 python-django ipython $ apt-get install gdal-bin python-gdal Ahora debemos configurar un poco postgres asi:Debemos volvernos root y luego el usuario postgres$ su $ su postrgres$ psql template1Este úlrimo comando nos conecta a postgres como el usuario postgres (el root del servidor de bases de datos), luego configuramos una plantilla para postigs (esto lo hacemos una sola vez)template1=# ALTER USER postgres WITH PASSWORD 'postgres';ALTER ROLETemplate1=# \qLuego:$ cd /tmp$ wget http://geodjango.org/docs/create_template_postgis-debian.sh$ bash create_template_postgis-debian.shEsto nos crea la plantilla template_postgis, ahora volvemos a postgres: $ createdb -T template_postgis geodjangoSalimos de postgres y del usuario root.Ahora creamos un projecto y la app:$ djano-admin startproject geodjango$ cd geodjango$ python manage.py startapp world Luego editamos el settings de nuestro proyecto con el editor de nuestra preferencia (sugerencia rapida gedit)$ gedit settings.py &Dejamos las siguientes variables así DATABASE_ENGINE = 'postgresql_psycopg2' DATABASE_NAME = 'geodjango' # Or path to database file if using sqlite3.DATABASE_USER = 'postgres' # Not used with sqlite3.DATABASE_PASSWORD = 'postgres' # Not used with sqlite3.DATABASE_HOST = 'localhost'LANGUAGE_CODE = 'es'INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.admin', … -
Probably Site Downtime
Howdy! As I'm moving the domain to a new server these days it could be possible that zoe.vc isn't reachable for some hours or even days. So don't be confused - everything will be alright after the movement is finished. Comments are disabled meanwhile. Thanks for your understanding! -
Annoying things about Django
Annoying things about Django -
Making tabularinline's collapse in Django 1.0
Django 1.0 admin doesn't treat inlined objects quite the same as normal fields. One quirk is setting a tabularinline to be collapsed by default. The solution is to make a new template and set the formset to have class=collapse. diff templates/admin/collapsed_tabular_inline.html /usr/share/python-support/python-django/django/contrib/admin/templates/admin/edit_inline/tabular.html 5c5< <fieldset class="module collapse">---> <fieldset class="module">and setting the template in admin.py class MyModelnline(admin.TabularInline): model = MyModel template = 'admin/collapsed_tabular_inline.html' Permalink | Leave a comment » -
La taberna esta casi lista www.lataberna.pe
He venido trabajando con algunos amigos en un site peruano www.lataberna.pe para un pub . La verdad el site esta orientado por su simplicidad, hemos tenido muchas peleas sobretodo por cuestiones de diseño. Aunque no estoy del todo contento con el acuerdo final, creo que se acerca bastante a lo que yo buscaba. El site [...] -
IPAddressField Indexing Problem in PostgreSQL
Indexing Django's IPAddressField field will be ignored in PostgreSQL. Why? Django forces a HOST function when querying such a field, as a result having PostgreSQL ignoring the existing index. Temporary Solution? 1. Create the IP address field in your DB Table with the appropriate type (in PostgreSQL it is INET), and index it right there. 2. Don't use IPAddressField in your models.py, use a standard CharField instead: ip = models.CharField(max_length=20)Just make sure to use the right data type in your DB. Postgres INET stores IP data much like an Integer. Storing IP data as string will take slightly more space and cause performance penalty. -
Сципион
Люций Корнелий Сципион по прозвищу Бородатый жил в Древнем Риме порядка трёх сотен лет до нашей эры. Был он не самым безвестным человеком. Сначала военачальником, довольно успешным, выигравшим несколько известных битв. А к концу жизни дослужился до должности консула. Но помимо прочего, был он ещё и цензором. Дойдя до наших дней, слово "цензор" утратило большую часть своих первоначальных значений, и сейчас означает человека, который не пускает к публикации материалы, подвергающие опасности текущий государственый строй. Однако в Древнем Риме основной работой цензора был, как ни странно, ценз. Под цензом понимался всего навсего учёт граждан республики с их имуществом, общественным положением и родом деятельности. По-современному говоря -- перепись населения. Надо сказать, что тогдашние цензоры к этой части своей работы относились без особого трепета, и точность данных этих переписей была довольно условной. Вроде как сейчас. Но вот этот самый Сципион Бородатый был известен как раз тем, что действительно этим занимался, и провёл довольно точную перепись. И вот вслед за римлянином Цицероном, именем которого я назвал свой форум, я решил взять имя Сципион (Scipio) для своего следующего интересного проекта. Это OpenID-консумер для Джанго, который умеет регистрировать пользователей (буквально вести перепись) и хранить информацию о их лояльности или нелояльности. Проект Scipio Сразу самое важное: страница … -
Сципион
Люций Корнелий Сципион по прозвищу Бородатый жил в Древнем Риме порядка трёх сотен лет до нашей эры. Был он не самым безвестным человеком. Сначала военачальником, довольно успешным, выигравшим несколько известных битв. А к концу жизни дослужился до должности консула. Но помимо прочего, был он ещё и цензором. Дойдя до наших дней, слово "цензор" утратило большую часть своих первоначальных значений, и сейчас означает человека, который не пускает к публикации материалы, подвергающие опасности текущий государственый строй. Однако в Древнем Риме основной работой цензора был, как ни странно, ценз. Под цензом понимался всего навсего учёт граждан республики с их имуществом, общественным положением и родом деятельности. По-современному говоря — перепись населения. Надо сказать, что тогдашние цензоры к этой части своей работы относились без особого трепета, и точность данных этих переписей была довольно условной. Вроде как сейчас. Но вот этот самый Сципион Бородатый был известен как раз тем, что действительно этим занимался, и провёл довольно точную перепись. И вот вслед за римлянином Цицероном, именем которого я назвал свой форум, я решил взять имя Сципион (Scipio) для своего следующего интересного проекта. Это OpenID-консумер для Джанго, который умеет регистрировать пользователей (буквально вести перепись) и хранить информацию о их лояльности или нелояльности. Проект Scipio Сразу самое важное: страница … -
Сципион
Люций Корнелий Сципион по прозвищу Бородатый жил в Древнем Риме порядка трёх сотен лет до нашей эры. Был он не самым безвестным человеком. Сначала военачальником, довольно успешным, выигравшим несколько известных битв. А к концу жизни дослужился до должности консула. Но помимо прочего, был он ещё и цензором. Дойдя до наших дней, слово "цензор" утратило большую часть своих первоначальных значений, и сейчас означает человека, который не пускает к публикации материалы, подвергающие опасности текущий государственый строй. Однако в Древнем Риме основной работой цензора был, как ни странно, ценз. Под цензом понимался всего навсего учёт граждан республики с их имуществом, общественным положением и родом деятельности. По-современному говоря — перепись населения. Надо сказать, что тогдашние цензоры к этой части своей работы относились без особого трепета, и точность данных этих переписей была довольно условной. Вроде как сейчас. Но вот этот самый Сципион Бородатый был известен как раз тем, что действительно этим занимался, и провёл довольно точную перепись. И вот вслед за римлянином Цицероном, именем которого я назвал свой форум, я решил взять имя Сципион (Scipio) для своего следующего интересного проекта. Это OpenID-консумер для Джанго, который умеет регистрировать пользователей (буквально вести перепись) и хранить информацию о их лояльности или нелояльности. Проект Scipio Сразу самое важное: страница … -
Custom Admin Views and Reversing Django Admin URLs
Custom Admin Views and Reversing Django Admin URLs -
FrOSCon 2009
Vergangenes Wochenende - am 22. und 23. August 2009 - fand in St. Augustin die FrOSCon statt. Für die FrOSCon war es (soweit ich weiß) das vierte Jahr, ich war zum ersten Mal dabei. Die FrOSCon ist eine zweitägige Konferenz zu den Themen Freie Software und Open Source. Neben einem sehr umfangreichen "offiziellen" Vortragsprogramm gibt es auch noch eine Reihe von sog. Projekträumen, in denen einzelne Open Source Projekte ihre eigenen Vorträge organisieren. In diesem Jahr gab es zum ersten Mal einen eigenen Projektraum für das Django Projekt. Zuerst gab es am Samstag von Markus Zapke-Gründemann im Hauptprogramm einen Django Vortrag, welcher viele Hörer anzog und später gab es dann im Django Projektraum noch den Vortrag "Django - lessons learned from a management perspective" von Jirka Schäfer und den Vortrag "Dojo and Django - The perfect couple" von Tobias von Klipstein. Beide Vorträge haben trotz der abgelegenen Lage des Django Projektraums viele Zuhörer angelockt. Auch zwischen den Vorträgen war der Django Projektraum gut besucht. Teilnehmer aus den Vorträgen konnten Fragen stellen und ergänzende Informationen erhalten und natürlich kam es auch zu spannenden Diskussionen zwischen den Entwicklern, die bereits aktiv mit Django arbeiten. Django Projektraum auf der FrOSCon Alles in Allem … -
Pinax setup on WebFaction Part 2
I scrapped everything I did in part 1 and followed this pretty much exactly: http://code.pinaxproject.com/wiki/DetailedPinaxWebfaction/ (note: I spent several hours trying to get my setup to work before I deleted everything and started from scratch following the DetailedPinaxWebfaction procedure. I recommend that you do the same if you're struggling. However, this may be outdated shortly as the Pinax folks are hard at work on the new release.) What I did differently from DetailedPinaxWebfaction: - Used Pinax-0.7beta3, not beta2 - Used Django-1.0.3, not 1.0.2 - mysql insted of postgresql in myproject/local_settings.py - Made slight variations to my ~/webapps/pinax07server/apache2/conf/httpd.conf: ServerRoot "/home/insert_user_account_here/webapps/pinax07server/apache2" LoadModule dir_module modules/mod_dir.so LoadModule env_module modules/mod_env.so LoadModule log_config_module modules/mod_log_config.so LoadModule mime_module modules/mod_mime.so LoadModule rewrite_module modules/mod_rewrite.so LoadModule wsgi_module modules/mod_wsgi.so KeepAlive Off Listen 37968 LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined CustomLog logs/access_log combined ServerLimit 2 WSGIPythonPath /home/insert_user_account_here/webapps/pinax07server/pinax-env/lib/python2.5/site-packages/ WSGIScriptAlias / /home/insert_user_account_here/webapps/pinax07server/myproject/deploy/pinax.wsgi LoadModule alias_module modules/mod_alias.so WSGIDaemonProcess pinaxWSGI user=insert_user_account_here group=insert_user_account_here threads=25 python-path=/home/insert_user_account_here/webapps/pinax07server/pinax-env/lib/python2.5/site-packages WSGIProcessGroup pinaxWSGI NameVirtualHost 127.0.0.1:insert_your_port_here ServerName insert_your_domain_here.com WSGIScriptAlias / /home/insert_user_account_here/webapps/pinax07server/myproject/deploy/pinax.wsgi ErrorLog "logs/myproject_2009_05_06.log" SetHandler none Alias /site_media /home/insert_user_account_here/webapps/static Permalink | Leave a comment » -
My notes on installing Pinax 0.7rc1 and integrating my Django art catalog app into it
This post is a mess and mainly for my own personal records. I've been up all night installing Pinax v0.7rc1, integrating my Django art cataloguing app with one of the Pinax sample projects, and trying to deploy it on Webfaction. I installed Pinax 0.7rc1 locally as per the "development version" instructions on their documentation site. Installation notes: - Install virtualenv and virtualenvwrapper before pinax, if you haven't already - When you create the pinax-env directory, do it inside of ~/.virtualenvs/- I ran into a dependency conflict - I had simplejson 1.9.2 installed, and it wanted 2.0.9. I removed the old one via synaptic and then deleted the old egg. When I tried rerunning the Pinax script that installs all the external dependencies, it completed successfully. Then, I cloned their sample social networking website social_project and played with the site (at localhost:8000). Its admin site at localhost:8000/admin also worked as expected. This is great, I thought. I was kind of surprised that I got it working so fast. The trick is to read every word of the installation docs carefully - I was running into problems until I forced myself to stop skimming the instructions over. Next, I decided to integrate … -
Logical Delete Support in Django
I have had a small set of functionality that I have copied to several projects and thought it was time to abstract it out as its own pluggable Django app. Thus, a new django app has been released onto the public -- django-logicaldelete. Check it out and let me know what you think! Here is the README.md copied for your reading pleasure: Django Logical Delete This is a small and simple app that I threw together to get some reuse out of something I do in nearly every project and every model I create. It's too easy for good data to get deleted and it be unrecoverable. It's also too easy to fix this by overriding the model's delete() method and just flagging records as deleted and then leveraging Django's Managers to override default behavior so that logically deleted items are not returned in querysets. There are two exceptions however, that I have found useful to this rule. In the admin I like to see everything with an indicator of whether or not it has been deleted, with the ability to filter down to just active records, (or deleted for that matter). I still think it is a valid request … -
Logical Delete Support in Django
I have had a small set of functionality that I have copied to several projects and thought it was time to abstract it out as its own pluggable Django app. Thus, a new django app has been released onto the public -- django-logicaldelete. Check it out and let me know what you think! Here is the README.md copied for your reading pleasure: Django Logical Delete This is a small and simple app that I threw together to get some reuse out of something I do in nearly every project and every model I create. It's too easy for good data to get deleted and it be unrecoverable. It's also too easy to fix this by overriding the model's delete() method and just flagging records as deleted and then leveraging Django's Managers to override default behavior so that logically deleted items are not returned in querysets. There are two exceptions however, that I have found useful to this rule. In the admin I like to see everything with an indicator of whether or not it has been deleted, with the ability to filter down to just active records, (or deleted for that matter). I still think it is a valid request … -
My art cataloging app
A few months ago, I wrote an app to catalog all of my artwork. I've lost track of quite a bit of my sold art over time, which makes me teary-eyed. My cataloging app is a Django app consisting of forms that I fill out with details about each art piece, e.g. dimensions, materials, where it's located, who owns it, any stories behind it, etc. After filling out the details, I upload a variable number of photos of each piece via the app's uploader, which generates thumbnails and sticks them into Amazon S3. I didn't bother much with the front-end back then because I already had what I needed. I hated js, css, html, ajax, etc., and the app was just for myself anyway. I used it to catalog a bunch of my art, and then I forgot about it. But last month I suddenly ramped up my front-end skills. So it was a delight to pick up the app yesterday afternoon and see it in a new light. I was up until 3am coding unnecessary things like transparent gradients overlaid on text, which I never had the motivation to do before. It's still not publicly accessible, but chances are … -
Django aggregation and most popular tags
Use Django to calculate most popular tags, or any query that makes use of an aggregation function. -
First impressions on Google Wave
I was really looking forward to get a chance to play with Google Wave. If you have not heard about this, Google is experimenting with a new means of communication and collaboration (to destroy any remains of your unused time!). Watch the video of the demo from Google IO conference to get a feel for [...] -
Django's Inlineformset_factory and You
Yesterday, while trying to set up a public-facing form for a recipes app, I ran into the issue of combining Django's ModelForm (for the Recipe model) with an inline for the foreign key Ingredients. One of my astute coworkers (there are many of them) poi -
Creating recursive, symmetrical many-to-many relationships in Django
In Django, a recursive many-to-many relationship is a ManyToManyField that points to the same model in which it's defined ('self'). A symmetrical relationship is one in where, when a.contacts = [b], a is in b.contacts. -
Django-filter 0.5 released!
I've just tagged and uploaded Django-filter 0.5 to PyPi. The biggest change this release brings is that the package name has been changed from `filter` to `django_filters` in order to avoid conflicts with the Python builtin `filter`. Other changes included the addition of an `initial` argument on Filters, as well as the addition of an `AllValuesFilter` which is a `ChoiceFilter` who's choices are any values currently in the DB for that field. Despite the change in package name I will not be changing the name of the project due to the overhead in moving the repository (Github doesn't set up redirects when you change a project's name) and the PyPi package. I hope everyone enjoys this new release, as a lot of it's improvements have come out of my usage on Django-filter in piano-man.As for what the future holds several people have indicated their interest in the inclusion of django-filter in Django itself as a contrib package, and for usage in the Admin as a new implementation of the `list_filter` option that is more flexible. Because of this my next work is probably going to be on implementing a custom `ModelAdmin` class that uses `FilterSets` for filtering.You can find the … -
Adventures in Django and Python – Part III
Read my previous two posts on Django and Python - Part I and Part II I've been working on a project management tool suite in Django. It's been a great side project to really experiment with Django in real-world scenarios. Forms At times I feel like I fight with newforms. In particular, it lacks the [...] Related posts:Django URL Parameter Passing and Python Strings Django and Python First Impressions – Part II Getting Started with Django and Python – First Impressions -
Requiring at least one inline FormSet
Last month I posted an article about my Improved Django FormWizard, well this month I've release a simple subclass of Django's BaseInlineFormSet that demonstrates how you can require a user to enter at least one entry in an inline formset.After updating to wadofstuff.django.forms 1.1.0 you can use the RequireOneFormSet class as the formset argument to inlineformset_factory().When the formset is