Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
How to handle variations with Javascript within Satchmo's product template
My goal was to list a set of variations on product page and redirect user to related product page if variation was changed. For example we have two variations:SizeColourAnd values of variatons:Colour: red, black, whiteSize: M (middle), L (large), S (small)So, first of all I display this variations on product page and when user change something (colour or size) then redirect to product with selected colour and size respectively.1. Show dropdowns with variations:{% for option_group in options %}{% trans "Select" %}{{ option_group.name }}{% for choice in option_group.items %} {{ choice.translated_name }}{% if choice.price_change %}{% option_price choice %}{% endif %}{% endfor %}{% endfor %}2. Store all possible variations for javascript to find related product if some of variations was changed on the page:// list of available variations of current product var variations = [ {% for product_variation in product.configurableproduct.productvariation_set.all %}{ 'url': '{{ product_variation.product.get_absolute_url }}', {% for option in product_variation.options.all %} 'group-{{ option.option_group.id }}': '{{ option.value }}'{% if not forloop.last %},{% endif %} {% endfor %} }{% if not forloop.last %},{% endif %}{% endfor %}];3. Add JavaScript code which will handle variations changes: /** * Select & go to variation which have been selected via select box. * This functionality require a … -
Offline HTML5 canvas app in Python with django-mediagenerator, Part 2: Drawing
In part 1 of this series we've seen how to use Python/pyjs with django-mediagenerator. In this part we'll build a ridiculously simple HTML5 canvas drawing app in Python which can run on the iPad, iPhone, and a desktop browser. Why ridiculously simple? There are a few details you have to keep in mind when writing such an app and I don't want these details to be buried under lots of unrelated code. So, in the end you will be able to draw on a full-screen canvas, but you won't be able to select a different pen color or an eraser tool, for example. These extras are easy to add even for a newbie, so feel free to download the code and make it prettier. It's a nice exercise. Reset the viewport With a desktop browser we could start hacking right away, but since we also support mobile browsers we need to fix something, first: One problem you face with mobile browsers is that the actual screen size is not necessarily the same as the reported screen size. In order to work with the real values we have to reset the viewport in the <head> section of our template: <head> <meta … -
bpssl - The Django SSL Support Application
bpssl - The Django SSL Support Application -
Quelques nouveautés de django 1.3
Comme l'indique la roadmap officielle, django 1.3 c'est pour dans bientôt. La bêta avec freeze des fonctionnalités, c'est pour dans 15 jours et la release, pour le 17 janvier. Tout bientôt donc. Il a de plus déjà été annoncé qu'il n'y aurait pas de nouvelles fonctionnalités dans cette version, que ce serait surtout une release ... -
Django with virtualenv on Webfaction
I really like the Django web framework and I like virtualenv enabling me to use different python configs and packages for different projects. And I have to say I like Webfaction, so easy, so good! (No, I don't get paid by them) This is a quick guide on how to setup Django in virtualenv using mod_wsgi with a Webfaction account. Create an "mod_wsgi" application and create a website to use this application connect to your accounts shell using ssh enable Python 2.6.x as default python (as written in the Webfaction documentation) run "vi ~/.bash_profile" append the line "alias python=python2.6" (navigate to the last line, push "i" for insertion, write the line, push escape) save the file and exit (enter ":wq") reload the bash profile "source ~/.bash_profile" ensure it worked by checking the Python version "python -V" install "pip" and "virtualenv" (be sure to use easy_install-2.6 to use the setuptools of Python 2.6.x): enter "easy_install-2.6 -U pip" enter "easy_install-2.6 -U virtualenv" I like yolk, that enables you to list the installed Python packages, install it using pip if you like "pip install yolk" Note that these packages (pip, virtualenv, yolk) are installed in your global Python. I recommend to not install … -
Django with virtualenv on Webfaction
I really like the Django web framework and I like virtualenv enabling me to use different python configs and packages for different projects. And I have to say I like Webfaction, so easy, so good! (No, I don't get paid by them) This is a quick guide on how to setup Django in virtualenv using mod_wsgi with a Webfaction account. Create an "mod_wsgi" application and create a website to use this application connect to your accounts shell using ssh enable Python 2.6.x as default Python interpreter (as written in the Webfaction documentation) echo "alias python=python2.6" >> ~/.bash_profile source ~/.bash_profile python -V install "pip" and "virtualenv" (be sure to use easy_install-2.6 to use the setuptools of Python 2.6.x): easy_install-2.6 -U pip easy_install-2.6 -U virtualenv I like yolk, that enables you to list the installed Python packages, install it using pip if you like pip install yolk Note that these packages (pip, virtualenv, yolk) are installed in your global Python. I recommend to not install any more packages to the global installation as virtualenv enables use to install all packages we need into the virtualenv Python lib. navigate to your recently create mod_wsgi webapp, there should be 2 folders, "apache2" and "htdocs" … -
Django with virtualenv on Webfaction
I really like the Django web framework and I like virtualenv enabling me to use different python configs and packages for different projects. And I have to say I like Webfaction, so easy, so good! (No, I don't get paid by them) This is a quick guide on how to setup Django in virtualenv using mod_wsgi with a Webfaction account. Create an "mod_wsgi" application and create a website to use this application connect to your accounts shell using ssh enable Python 2.6.x as default Python interpreter (as written in the Webfaction documentation) echo "alias python=python2.6" >> ~/.bash_profile source ~/.bash_profile python -V install "pip" and "virtualenv" (be sure to use easy_install-2.6 to use the setuptools of Python 2.6.x): easy_install-2.6 -U pip easy_install-2.6 -U virtualenv I like yolk, that enables you to list the installed Python packages, install it using pip if you like pip install yolk Note that these packages (pip, virtualenv, yolk) are installed in your global Python. I recommend to not install any more packages to the global installation as virtualenv enables use to install all packages we need into the virtualenv Python lib. navigate to your recently create mod_wsgi webapp, there should be 2 folders, "apache2" and "htdocs" … -
Django with virtualenv on Webfaction
I really like the Django web framework and I like virtualenv enabling me to use different python configs and packages for different projects. And I have to say I like Webfaction, so easy, so good! (No, I don't get paid by them) This is a quick guide on how to setup Django in virtualenv using mod_wsgi with a Webfaction account. Create an "mod_wsgi" application and create a website to use this application connect to your accounts shell using ssh enable Python 2.6.x as default Python interpreter (as written in the Webfaction documentation) echo "alias python=python2.6" >> ~/.bash_profile source ~/.bash_profile python -V install "pip" and "virtualenv" (be sure to use easy_install-2.6 to use the setuptools of Python 2.6.x): easy_install-2.6 -U pip easy_install-2.6 -U virtualenv I like yolk, that enables you to list the installed Python packages, install it using pip if you like pip install yolk Note that these packages (pip, virtualenv, yolk) are installed in your global Python. I recommend to not install any more packages to the global installation as virtualenv enables use to install all packages we need into the virtualenv Python lib. navigate to your recently create mod_wsgi webapp, there should be 2 folders, "apache2" and "htdocs" … -
Livro Python e Django – Resenha
Finalizei a leitura do livro Python e Django — Desenvolvimento ágil de aplicações web, escrito pelo Osvaldo Santana. Estamos carentes de bons livros sobre Python e Django em português e o Osvaldo soube preencher bem essa lacuna com um material de excelente qualidade, tanto para aqueles que querem aprender quanto para quem já trabalha com Python e Django. Recebi o livro a algumas semanas, mas fiz questão de ler com bastante atenção antes de escrever essa resenha. Para quem está procurando um ótimo material em português, o livro começa explicando o básico de Python, funções, bultins, módulos, classes e orientação a objetos. As explicações de cada item são curtas e recheadas de exemplos, ideal para quem não quer perder tempo com muita teoria e quer aprender na prática, mas com as explicações teóricas na dose certa. A partir do capítulo 5 o livro entra na parte de programação, com exemplos e dicas interessantes. O capítulo 6 explica sobre orientação a objetos, em uma linguagem didática e direta ao ponto. No capítulo 8, o Django é apresentado, assim como uma boa explicação sobre o paradigma MVC. Logo em seguida vem a modelagem de dados, templates, formulários e segurança. Todo conteúdo teórico … -
Introducció a Celery
Introducció a Celery Celery es una aplicació que ens permet crear tasques de feina asíncrones gestionades per un gestor de cues que està basada en l'enviament de missatges de manera distribuïda. Es focalitza en operacions en temps real però també suporta la calendarització de tasques. Les unitats d'execució, anomenades tasques, s'executen de manera concurrent en un o més nodes de treball. Aquestes tasques poden executar-se de manera asíncrona bé de manera síncrona (esperant fins que la tasca està llesta). El sistema de missatgeria recomanat per celery és RabbitMQ encara que és bastant agnòstic en el tema i pot fer servir com a substitut Redis, MongoDB o una base de dades sql. Encara que el programa va sorgir lligat a Django, actualment és una llibreria que es pot utilitzar de manera independent. S'han creat dos projectes a partir de l'original, Celery manté l'estructura bàsica de la llibreria i django-celery manté la integració amb Django. Bé, fins aquí la parrafada d'introducció traduïda amb més o menys fortuna de la documentació de Celery, el que estam dien és que celery ens permet executar tasques de manera distribuïda, on el director d'orquestra (si seguim les recomanacions) és una aplicació anomenada RabbitMQ, escrita en Erlang, … -
django-lastfm
On my old Wordpress blog I had a widget that let me display some of my last.fm stats. Since there was no such widget for Django powered sites (or I didn’t search well enough), I created my own as you can see in the right column. You currently can choose between your recently listened tracks, your weekly artist chart and your top artists. I’ve created a bitbucket project for its further development. So go clone it and give some feedback. PS: I’ll update/write the documentation within the next few days … ;-) -
django-lastfm
On my old Wordpress blog I had a widget that let me display some of my last.fm stats. Since there was no such widget for Django powered sites (or I didn’t search well enough), I created my own as you can see in the right column. You currently can choose between your recently listened tracks, your weekly artist chart and your top artists. I’ve created a bitbucket project for its further development. So go clone it and give some feedback. PS: I’ll update/write the documentation within the next few days … ;-) -
Django-sphinxdoc 0.2 now with documentation!
Just released version 0.2 of django-sphinxdoc. It can now display the documentation itself, the general index and the module index. The source and static views as well as the search functionality is not implemented yet. I’m still pondering whether to use a Google custom search or the Sphinx JavaScript search. Maybe it would be even better if I used Haystack … You can find a quick guide as well as some other guides in django-sphinxdoc’s documentation section (which is of course powered by django-sphinxdoc ;-)). The download can be found at bitbucket.org. -
Django-sphinxdoc 0.2 now with documentation!
Just released version 0.2 of django-sphinxdoc. It can now display the documentation itself, the general index and the module index. The source and static views as well as the search functionality is not implemented yet. I’m still pondering whether to use a Google custom search or the Sphinx JavaScript search. Maybe it would be even better if I used Haystack … You can find a quick guide as well as some other guides in django-sphinxdoc’s documentation section (which is of course powered by django-sphinxdoc ;-)). The download can be found at bitbucket.org. -
django-sphinxdoc 1.0
Most Python projects use Sphinx for their documentation. And many (most?) Python powered websites use Django as framework. So there might be some people who use both Sphinx and Django. If you belong to this group and want to integrate the documentation of your projects into your Django powered website, django-sphinxdoc might be the app you’re searching for. Django-sphinxdoc can build and import your Sphinxdocumentation and provides views for browsing and searching it. You can see django-sphinxdoc in action be reading its documentation. What’s new in this version? You can now search the documentation (via Haystack). New management command updatedoc for importing and building JSON files from your documentation and updating Haystack’s search index. New model Document for JSON files. Renamed the App model to Project What’s planned for the future? Allow users to comment the documentation. You can find django-sphinxdoc in the Cheese Shop or at Bitbucket. -
django-lastfm 1.0
Django-lastfm is a small Django app that allows you to embed your charts or recently listened tracks from Last.fm into your website. You can see the widget in action in the sidebar of this website. I raised its version to 1.0 since there have been no problems for a long time and there are also no features I want to include. You can find django-lastfm in the Cheese Shop or at Bitbucket. -
django-lastfm 1.0
Django-lastfm is a small Django app that allows you to embed your charts or recently listened tracks from Last.fm into your website. You can see the widget in action in the sidebar of this website. I raised its version to 1.0 since there have been no problems for a long time and there are also no features I want to include. You can find django-lastfm in the Cheese Shop or at Bitbucket. -
Préparez un solide alibi, parce que nous savons que vous avez un mobile, un django-mobile
J'ai déjà fait un billet parlant d'une app de monsieur gregmuellegger, à savoir celui sur les websockets. Mais le monsieur étant prolifique, je me vois 'obligé' d'écrire à nouveau sur une de ses apps, à savoir django-mobile. 1- Où on le trouve, comment on l’installe, tout ça quoi (et la doc) ? Alors on trouve django-mobile à ... -
Use JSON instead of YAML for Django test fixtures
Today I learned that JSON is much faster than YAML for use in Django fixtures... -
Django-Articles 2.1.1 Released
I've been working on some neat changes to django-articles recently, and I've just released version 2.1.1. The most noticeable feature in this release is Auto-Tagging. Since I feel like I've described the feature fairly well in the README, I'll just copy/paste that section here. The auto-tagging feature allows you to easily apply any of your current tags to your articles. When you save an Article object with auto-tagging enabled for that article, django-articles will go through each of your existing tags to see if the entire word appears anywhere in your article's content. If a match is found, that tag will be added to the article. For example, if you have tags "test" and "art", and you wrote a new auto-tagged Article with the text: This is a test article. django-articles would automatically apply the "test" tag to this article, but not the "art" tag. It will only apply the "art" tag automatically when the actual word "art" appears in the content. Auto-tagging does not remove any tags that are already assigned to an article. This means that you can still add tags the good, old-fashioned way in the Django Admin without losing them. Auto-tagging will only add to an … -
Django-Articles 2.1.1 Released
I've been working on some neat changes to django-articles recently, and I've just released version 2.1.1. The most noticeable feature in this release is Auto-Tagging. Since I feel like I've described the feature fairly well in the README, I'll just copy/paste that section here. The auto-tagging feature allows you to easily apply any of your current tags to your articles. When you save an Article object with auto-tagging enabled for that article, django-articles will go through each of your existing tags to see if the entire word appears anywhere in your article's content. If a match is found, that tag will be added to the article. For example, if you have tags "test" and "art", and you wrote a new auto-tagged Article with the text: This is a test article. django-articles would automatically apply the "test" tag to this article, but not the "art" tag. It will only apply the "art" tag automatically when the actual word "art" appears in the content. Auto-tagging does not remove any tags that are already assigned to an article. This means that you can still add tags the good, old-fashioned way in the Django Admin without losing them. Auto-tagging will only add to an … -
Using Django Authentication with Twisted Perspective Broker
For my third year project, I have hooked Twisted's Perspective Broker authentication into Django, so that a networked application can authenticate itself against Django's central user database (django.contrib.auth). The process is pretty quick and easy, thanks to Twisted's pluggable nature, and Django's pure simplicity. The Checker Firstly, we create a class which will actually do [...] -
Configuration and architecture
This is the second part in my series about building a build farm for Django with Buildbot. Part 1 covered some background, including the specific problems facing a CI system for Django's core development. Starting in this part I'll be looking at the actual code I wrote to solve these problems. It's running now at buildbot.djangoproject.com, and the code's on GitHub. Please feel free to take a look (and fork/reuse if you want) but keep in mind it's very much a work-in-progress. You'll probably notice me updating this stuff a bunch over the next few days/weeks. If you're not already a bit familiar with Buildbot you might have a bit of trouble following what's coming next, particularly because I'm going to deviate quite a bit from the documented way of doing things. If you'd like to learn the "party line" -- and I suggest that you do, since I'm quite possibly doing something a bit insane here -- then I'd suggest either the official documentation (which is quite good, if a bit rough), or the relevant chapters from Jeff Younker's Foundations of Agile Python Development The first think you'll notice if you look at my code is that doesn't look … -
Taming the Komodo dragon for virtualenv and python
My first python editor on osx was textmate. Like many others I love it's simplicity, bundles, and the fact that it actually feels like an osx app and not some OS bastard love child, but after a while I found I really wanted seamless autocomplete and calltips which I'd always had on Windows. Every year I look in vain at the macromates site for textmate 2, and every year I become increasingly -
Configuration and architecture
This is the second part in my series about building a build farm for Django with Buildbot. Part 1 covered some background, including the specific problems facing a CI system for Django’s core development. Starting in this part I’ll be looking at the actual code I wrote to solve these problems. It’s running now at buildbot.djangoproject.com, and the code’s on GitHub. Please feel free to take a look (and fork/reuse if you want) but keep in mind it’s very much a work-in-progress.