Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Untitled
hej -
Untitled
hej -
Что такое pip?
Pip это альтернатива easy_install, а как говорят сами разработчики - замена. Как известно easy_install только часть глыбы под названием setuptools. Много копий сломано по поводу нужно ли такие двухголовое чудовище, которое позволяет продвинутым образом собирать питонячьи пакеты и их устанавливать. Или достаточно стандартного distutils. Вот тут pip выступает как противоположность, говоря - я сборкой пакетов не занимаюсь, а только их ставлю. Pip может поставить любой пакет собранный при помощи distutils. Причем только source-пакет - никаких бинарных яиц ему и прочих setuptools'овых прибамбасов. Эта концептуальная простота во многом помогла pip постепенно выйти на уровень широко используемого инструмента в питон-сообществе. Благо и пользоваться им максимально просто: # pip install wna где wna - это некий пакет (для примера я возьму код своего блога). Так же преимуществом pip безусловно является более полезный вывод информации о процессе установки и репортинг ошибок во всяких непредвиденных ситуациях. Помимо уже собранных source-пакетов pip может брать исходники пакетов из систем контроля версий. Поддерживаются subversion, mercurial, git, bazaar. Делая checkout и устанавливая через python setup.py с ключом devel, дает возможность иметь в папке /src/packet_name/ исходный код и при необходимости редактировать его. # pip install -e hg+http://bitbucket.org/daevaorn/turbion/#egg=turbion Где egg=turbion говорит pip чтобы он сделал checkout в /src/turbion/. Очень полезная возможность, … -
sphinx autodoc and django app
Today I have been getting my foot wet with autodoc extension from sphinx. Here it is what the documentation of sphinx say about it :"""Sphinx is a tool that makes it easy to create intelligent and beautiful documentation, written by Georg Brandl and licensed under the BSD license."""I have to say that before today my experience with sphinx as been excellent. It is relatively straightforward to get started once you pass the first little annoyances that come with the fact that you are learning a new tool.The module I have been using to conduct this experiment is django-geotagging this reusable app enables you to geotag any object in the database. If you want to know more about this you can read the sphinx based documentation. This is the goal of the documentation, isn't it ? :-)If adding a manually written documentation is very easy and well documented. The modification required to move from a very primitive documentation written using some rst file to sphinx is shown here. Most of it is automatically generated by : sphinx-quickstart.Taking it a step further have been more difficult than anticipated and this for several reasons : lack of example, and a bugToday I wanted … -
How Great is Django's Documentation?
One aspect of Django that never ceases to amaze me, is how well it is documented. I believe this aspect of the Django project got many of us to use it, me included. While doing some boring graduate donkey work, Django’s name popped out, and not surprisingly, as one of the highly documented code bases out there (only projects focusing on documentation came close!). So lets me take this opportunity to thank all those who might be reading this, who had a hand in making Django what it is (Thank you!) The Lines of documentation to SLOC ratio is plotted against SLOC for 1st of Jan, 2009. Django has one of the highest ratios compared to other open source projects of similar size (See the top part of the Graph). Of course I could have plotted doc lines to SLOC, but then I have to show the deviation of Django from the regression line. This graph just makes it more obvious and is easier to plot: Click to enlarge, and don’t forget to zoom in. I also have a few questions should any Django contributors pass by. Any of you guys think that you might have over done it? Is it difficult to … -
ModelAdmin readonly fields
Finalizing my web application, there was a few outstanding patches left to do. One of this I always felt strange why it was left out in the open. Django's admin interface form by default allows you to edit the primary key of the model. I always felt strange why it allowed this as it led to unexpected behavior. My users would edit the primary key expecting the changes to be done on the record which of course did not happen as django created another new object with the new edited id. In solving this bug I was hoping that django's admin model allowed for something like 'readonly = ( 'id_field')' or something like to that respect. Just thinking out aloud but shouldn't this be automatically done for all primary key fields in models.py ? Shouldn't the primary key be made non editable by default unless explicitly stated in the definition? Even then should the primary key be allowed to be edited? If a user were to be allowed to edit the primary key, would it really be editing or 'cloning' a new object with similar data but differing ids? I haven't really done a thorough search yet but I think … -
Django-Loupe for Design Collaboration
I've been using Basecamp for years and have a love/hate relationship with it simply because it costs me money for clients that don't want to use it. However, I can't get rid of it because there are a few clients I have that need collaboration for designs. For coding projects I use various ticketing systems from Trac to Sifter and I won't get into that in this post. During a current project Trac is being used for the backend parts but it falls apart on design collaboration. After a few late nights I'm thrilled with the progress of Django-Loupe for design collab. -
Django - migracje z south
South jest jedną z najlepszych aplikacji do prostego tworzenia migracji struktur baz danych w Django. Używam south'a od wersji 0.3. I muszę powiedzieć że jest to naprawdę dobre narzędzie. Ułatwia prace przy tworzeniu i rozwijaniu aplikacji w Django. Normalnie gdy tworzymy aplikacje w Django i korzystamy z syncdb, gdy chcemy zmienić strukturę bazy danych to musimy albo usunąć całą bazę i ponownie wykonać syncdb lub pisać "ręcznie" SQL który zmieni tą strukturę. Dodatkowym problemem jest jeżeli chcemy później te same zmiany struktury bazy danych wykonać na środowisku produkcyjnym. Przy większych projektach jest bardzo uciążliwe i zajmuje bardzo dużo czasu. Chciałbym opisać tutaj swoje doświadczenia z south 0.5 i pokazać jego możliwości. Instalacja Jeżeli nie mamy jeszcze zainstalowanego south'a to instalujemy: easy_install south Zaczynamy: Tworzymy projekt który posiada dwie aplikacje books oraz authors. django-admin.py startproject southtest manage.py startapp books manage.py startapp authors Dopisujemy south oraz aplikacje books i authors do INSTALLED_APPS i robimy syncdb. South stworzy sobie tabele w której będzie trzymać historie migracji. Dopisujemy modele do aplikacji books i authors Modele z aplikacji authors: from django.db import models class Author(models.Model): name = models.CharField(max_length=30) Modele z aplikacji books: from django.db import models from southtest.authors.models import Author class Book(models.Model): name = models.CharField(max_length=30) … -
Djangodose Logo
I finally got some time to work on my backlog of logos this week and they are starting to hit the streets. So if you're waiting on me to finish the commissioned logos, they are coming quickly! Sorry for delays, it's been hell-busy here. First out the door is the new djangodose logo for they great guys of TWiD fame Eric Florenzano, Brian Rosner and Kevin Fricovsky. I believe they have announced they are recording this Sunday for those (including myself) who are anxious for the new show. I'm still working on the site design which will be finished just in time for the show release. -
Adaptador do Django para DB2 lançado!
Adaptador do Django para DB2 lançado! -
Adaptador do Django para DB2 lançado!
Adaptador do Django para DB2 lançado! -
EuroDjangoCon 2009
EuroDjangoCon 2009 is still going strong, but I wanted to share the materials from my talk as quickly as possible. My slides are on Slide Share:Forms, Getting Your Money's WorthView more presentations from kingkilr.And the first examples code follows:from django.forms.util import ErrorListfrom django.utils.datastructures import SortedDictdef multiple_form_factory(form_classes, form_order=None): if form_order: form_classes = SortedDict([(prefix, form_classes[prefix]) for prefix in form_order]) else: form_classes = SortedDict(form_classes) return type('MultipleForm', (MultipleFormBase,), {'form_classes': form_classes})class MultipleFormBase(object): def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=ErrorList, label_suffix=':', empty_permitted=False): if prefix is None: prefix = '' self.forms = [form_class(data, files, auto_id, prefix + form_prefix, initial[i], error_class, label_suffix, empty_permitted) for i, (form_prefix, form_class) in enumerate(self.form_classes.iteritems())] def __unicode__(self): return self.as_table() def __iter__(self): for form in self.forms: for field in form: yield field def is_valid(self): return all(form.is_valid() for form in self.forms) def as_table(self): return '\n'.join(form.as_table() for form in self.forms) def as_ul(self): return '\n'.join(form.as_ul() for form in self.forms) def as_p(self): return '\n'.join(form.as_p() for form in self.forms) def is_multipart(self): return any(form.is_multipart() for form in self.forms) def save(self, commit=True): return tuple(form.save(commit) for form in self.forms) save.alters_data = TrueEuroDjangoCon has been a blast thus far and after the conference I'll do a blogpost that does it justice. -
Towards a Standard for Django Session Messages
Django needs a standard way in which session-specific messages can be created and retrieved for display to the user. For years we’ve been surviving using user.message_set to store messages that are really specific to the current session, not the user, or using the latest and greatest Django snippet, pluggable app, or custom crafted middleware to handle messages in a more appropriate way. -
Google Appengine SDK 1.2.3
Google Appengine SDK 1.2.3 -
Read only fields in models
Supposing you have a field in your model and you don't want it to be changed, ever. -
stockphoto on bitbucket
So, development of stockphoto , my Django-based photo gallery application has been languishing for a long time. Like, three years ... -
stockphoto on bitbucket
So, development of stockphoto , my Django-based photo gallery application has been languishing for a long time. Like, three years ... -
Частные проблемы использования django-evolution
Сегодняшний день для меня ознаменовался эпичной битвой с django-evolution. С различными неудобствами этого приложения мы в разработке сначала Куда Все Идут, а потом Афиши сталкиваемся уже довольно давно. Сегодняшний же случай наконец заставил меня перебороть лень и изложить эти проблемы для публики. Должен, тем не менее, обязательно сказать, что не считаю django-evolution плохим средством, потому что знаю, что во многих сценариях использования он вполне справляется со своими обязанностями. Однако архитектурные особенности нашего проекта и наши рабочие привычки, видимо, совмещаются с ним плохо. Поэтому принимайте текст как есть, без далеко идущих выводов, просто к сведению. Очерёдность с syncdb Одно из выбранных решений django-evolution -- невмешательство в дела команды syncdb. То есть, django-evolution никогда не пытается выполнять SQL код для создания таблиц. Первое неудобство в этом для нас -- более сложный процесс составления миграционного SQL'а. Дело в том, что наши админы не шибко любят запускать изменения в базах всякими неконтролируемыми тулзами, а просят присылать им SQL-скрипты. Django-evolution умеет генерить SQL своих эволюций, а SQL для создания таблиц приходится вырезать руками из базы отдельно. Но гораздо хуже другое. Представьте, что в процессе миграции базы с достаточно старой версии есть и новые модели, и эволюции, применяемые к этим моделям. Поскольку создавать таблицы надо отдельной … -
Частные проблемы использования django-evolution
Сегодняшний день для меня ознаменовался эпичной битвой с django-evolution. С различными неудобствами этого приложения мы в разработке сначала Куда Все Идут, а потом Афиши сталкиваемся уже довольно давно. Сегодняшний же случай наконец заставил меня перебороть лень и изложить эти проблемы для публики. Должен, тем не менее, обязательно сказать, что не считаю django-evolution плохим средством, потому что знаю, что во многих сценариях использования он вполне справляется со своими обязанностями. Однако архитектурные особенности нашего проекта и наши рабочие привычки, видимо, совмещаются с ним плохо. Поэтому принимайте текст как есть, без далеко идущих выводов, просто к сведению. Очерёдность с syncdb Одно из выбранных решений django-evolution — невмешательство в дела команды syncdb. То есть, django-evolution никогда не пытается выполнять SQL код для создания таблиц. Первое неудобство в этом для нас — более сложный процесс составления миграционного SQL'а. Дело в том, что наши админы не шибко любят запускать изменения в базах всякими неконтролируемыми тулзами, а просят присылать им SQL-скрипты. Django-evolution умеет генерить SQL своих эволюций, а SQL для создания таблиц приходится вырезать руками из базы отдельно. Но гораздо хуже другое. Представьте, что в процессе миграции базы с достаточно старой версии есть и новые модели, и эволюции, применяемые к этим моделям. Поскольку создавать таблицы надо отдельной … -
Частные проблемы использования django-evolution
Сегодняшний день для меня ознаменовался эпичной битвой с django-evolution. С различными неудобствами этого приложения мы в разработке сначала Куда Все Идут, а потом Афиши сталкиваемся уже довольно давно. Сегодняшний же случай наконец заставил меня перебороть лень и изложить эти проблемы для публики. Должен, тем не менее, обязательно сказать, что не считаю django-evolution плохим средством, потому что знаю, что во многих сценариях использования он вполне справляется со своими обязанностями. Однако архитектурные особенности нашего проекта и наши рабочие привычки, видимо, совмещаются с ним плохо. Поэтому принимайте текст как есть, без далеко идущих выводов, просто к сведению. Очерёдность с syncdb Одно из выбранных решений django-evolution — невмешательство в дела команды syncdb. То есть, django-evolution никогда не пытается выполнять SQL код для создания таблиц. Первое неудобство в этом для нас — более сложный процесс составления миграционного SQL'а. Дело в том, что наши админы не шибко любят запускать изменения в базах всякими неконтролируемыми тулзами, а просят присылать им SQL-скрипты. Django-evolution умеет генерить SQL своих эволюций, а SQL для создания таблиц приходится вырезать руками из базы отдельно. Но гораздо хуже другое. Представьте, что в процессе миграции базы с достаточно старой версии есть и новые модели, и эволюции, применяемые к этим моделям. Поскольку создавать таблицы надо отдельной … -
South is amazing
I just started using South and it is awesome. I tried django-evolution and dmigrations before but they just didn't cut it. I'm just working on a project by myself but I have it running on a slicehost server and I do development on my desktop computer or laptop computer and South has made doing data and schema migrations so much easier. I love being able to create migrations on my dev box and then try them out, make sure they worked, check-in the changed code and the migration files, sync the server's code and run ./manage.py migrate and I'm done. I used to do manual SQL operations on both databases, or just overwrite the older with the newer (if possible). I just did two quick model changes (first was adding a new field that I wanted to seed with the data from another field, and the other was just adding a new blank=True CharField) and I felt like it was an order of magnitude faster than before. -
South is amazing
[img_assist|nid=369|title=|desc=|link=none|align=right|width=210|height=70] I just started using South and it is awesome. I tried django-evolution and dmigrations before but they just didn't cut it. I'm just working on a project by myself but I have it running on a slicehost server and I do development on my desktop computer or laptop computer and South has made doing data and schema migrations so much easier. I love being able to create migrations on my dev box and then try them out, make sure they worked, check-in the changed code and the migration files, sync the server's code and run ./manage.py migrate and I'm done. I used to do manual SQL operations on both databases, or just overwrite the older with the newer (if possible). I just did two quick model changes (first was adding a new field that I wanted to seed with the data from another field, and the other was just adding a new blank=True CharField) and I felt like it was an order of magnitude faster than before. -
Smug Enhancements
Something I've had on my todo list for a very long time now was to get my notes from School published automatically on my website. They are already stored in ReStructured Text, and they are already stored in git repositories, so my use of smug already had me 95% of the way there. (I have a write-up about my note taking method: here) I spent my day off, and finally found some better approaches to the problems I had, and I now have automatic sharing of my notes on my website. The thing that was holding me back was the fact that smug couldn't do everything I wanted it to. I also store other things, such as homework, papers, and other assignments in the same git repository. Also, the way that I would organize a website is different than I would organize my personal files. Here is an example of how I might have a git repository laid out for a given class: ecen924/ +-notes/ +-homework/ +-research_papers/ syllabus.rst This is a very logical way to lay out my own personal repository. If I decide to work on this class, I simply change to the base directory, and I can easily … -
Desenvolvedores do backend do Django 1.1 para Firebird pedem ajuda
Desenvolvedores do backend do Django 1.1 para Firebird pedem ajuda -
Desenvolvedores do backend do Django 1.1 para Firebird pedem ajuda
Desenvolvedores do backend do Django 1.1 para Firebird pedem ajuda