Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
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 -
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 -
Contributor analysis
Some of you might find it interesting to know that over 900 unique contributors have participated in Django’s development since Jan 1st, 2007, as attributed by the svn log messages. I would say the community is very healthy especially if you compare it to other well known projects: Django: 906 Pylons: 80 PyPy: 240 Linux Kernel: 4043 PostgreSQL: 150 Appache HTTP server: 118 SQLAlchemy: 36 (Contributors identified from trac tickets mentioned in svn log) Python: 428 Note that I consider anonymous or guest contributors as a single contributor, so these number can be considered conservative if the project allows anonymous contributions. -
Inlines support for Django generic views
Django's excellent Generic Views provide developers with most of what they need to get a site up and running (if they aren't using the Admin of course). The flexibility of these views is such that for most sites you don't need much else. Extending these views is also well documented and probably covers off 95% of the situations where the plain generic views fall short.In a recent project I found -
Let's talk about WSGI
Recently Armin Ronacher (whose blog you should be reading if you do anything at all involving Python and the web) has published a couple of good articles poking at the current state of WSGI, the standard interface for Python web applications. Some of his comments dovetail nicely into concerns I’ve been trying to put into words for a while now, so I’m glad he’s posting on the subject and providing some context. In short, I’ve come ... Read full entry -
Let's talk about WSGI
Recently Armin Ronacher (whose blog you should be reading if you do anything at all involving Python and the web) has published a couple of good articles poking at the current state of WSGI, the standard interface for Python web applications. Some of his comments dovetail nicely into concerns I’ve been trying to put into words for a while now, so I’m glad he’s posting on the subject and providing some context ... Read full entry -
Atualizações de segurança
Atualizações de segurança -
Atualizações de segurança
Atualizações de segurança