Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
A BeautifulSoup with Django and Pygments
Just added syntax highlighting using BeautifulSoup and Pygments. I took the SaltyCrane Blog for inspiration, but in contrast to it, I implemented it as a template filter in a separate application. This is surely not the most performant way, but I’m planning to use memcache, so I think this is ok. Here an example how to use the filter: {% load highlight_code %} {{ my_var_with_code|highlight|safe }} -
SEO scumbags
Please die in a fire: From: <…@hootsmart.com> Subject: I would like to offer free SEO for the djangoproject.com Hi Jacob, I would like to offer my SEO services free of charge for the djangoproject and in return to have a link from the djangoproject.com web page to my own site. 1. I Would like to contribute free SEO advice to the project ( could write a paper on SEO techniques). -
New Project: Telvee
I have been working on telvee for a few months. To be precise gitk tells the initial commit was at 2009-06-24 16:20:38. I have been meaning to write about it but just couldn’t find the time (or should I say couldn’t drag my lazy ass to do it). Anyway. I have marked version 0.3 for [...] -
Recovery.gov Augmented Reality Mashup
As of today Android and iPhone 3GS users can see recovery.gov contract data on their phones via the Layar augmented reality application. Layar is an application that overlays your view of the real world with waypoints representing your favorite coffee place, the movie theatre you're trying to find, or in this case, where some of that $787 billion from the American Recovery and Reinvestment Act is going. If you have an iPhone 3GS or Android device you can install the Layar app for free and then search for "recovery" or "sunlight" within Layar to find this layer. The layer works best near large cities where you are most likely to find recovery contracts, below is an example of what it looks like on the streets of Washington DC. There are also a few options to help you filter the results should you be in a contract-heavy area like DC, it is possible to filter by amount or search by name if you're trying to find larger contracts or contracts for a certain nearby recipient. This data is taken from the recovery.gov Where Is The Money Going? map which provides a KML file containing all recipient reported Contracts. As of October … -
South 0.6.2
In my neverending quest to save the time of those using RDBMSen, South 0.6.2 is released. It mostly contains bugfixes, but there's now support for extending introspection to third-party apps without having to edit their source. I'll probably start working full steam on South 0.7 soon - there's a refactor of the migration engine (mostly done), of startmigration (not started), and a few changes to command names to make them nicer (the old ones will still work), and to the behaviour of default values. I'm hoping 0.7 will be the last release before 1.0, at which point I will claim I've been working in an octal version numbering sequence all along. -
django-piston authentication against django auth -- part 4
The previous post ends with one known "Open Issue". The authentication for the ajax call was sitll hard coded [1]. In this post I am going to show you how you can extend django-piston to authenticate your users against django.contrib.auth. This might be important if your web app already take advantage of this module to manage and authenticate users.A bit of reading of the source code and the documentation of django-piston [2] leads me to understand that django-piston has been designed from the ground to enable you to easily write your own authentication handler. Out of the box it comes with "HttpBasicAuthentication" and OAuthAuthentication. "HttpBasicAuthentication" is a very good example how to implement a DjangoAuthentication.An authentication handler is a class, which must have 2 methods: is_authenticated, challengeclass DjangoAuthentication(object): """ Django authentication. """ def __init__(self, login_url=None, redirect_field_name=REDIRECT_FIELD_NAME): if not login_url: login_url = settings.LOGIN_URL self.login_url = login_url self.redirect_field_name = redirect_field_name self.request = None def is_authenticated(self, request): """ This method call the `is_authenticated` method of django User in django.contrib.auth.models. `is_authenticated`: Will be called when checking for authentication. It returns True if the user is authenticated False otherwise. """ self.request = request return request.user.is_authenticated() def challenge(self): """ `challenge`: In cases where `is_authenticated` returns False, … -
Talented front-end developer job for Web 2.0 company in Oxford
The company I work for, 2Degrees, is looking for a front-end developer to join our team. Are you a CSS monkey? We need a CSS monkey with a good working knowledge of browser quirks and the ability to get even IE6 looking good (although you don't have to like it). It would help if you don't run away screaming from Javascript and can play well with the code monkeys. More details are below. Email the address at the bottom of the job description, and mention this blog! -
Talented front-end developer job for Web 2.0 company in Oxford
The company I work for, 2Degrees, is looking for a front-end developer to join our team. Are you a CSS monkey? We need a CSS monkey with a good working knowledge of browser quirks and the ability to get even IE6 looking good (although you don't have to like it). It would help if you don't run away screaming from Javascript and can play well with the code monkeys. More details are below. Email the address at the bottom of the job description, and mention this blog! Job Description Would you like to do something genuinely useful with your client side development skills - UI, XHTML, CSS (JavaScript, AJAX) 2degrees is an exciting, fast-paced, well-funded Web2.0 environmental networking business based in Oxford. We're looking for a top-notch client-side developer eager to work with our talented team to evolve our django-based Web2.0 application to meet the demands of our members and corporate partners (Cisco, EDF, British Gas, IBM) 2degrees’ purpose is to accelerate the speed at which businesses are able to implement sustainability and carbon reduction strategies on a global scale. Our members include sustainability professionals from companies such as HSBC, Coca-Cola, BASF, Sony, Marks & Spencer, BP, Shell, Eurostar, Sainsbury’s, … -
Talented front-end developer job for Web 2.0 company in Oxford
The company I work for, 2Degrees, is looking for a front-end developer to join our team. Are you a CSS monkey? We need a CSS monkey with a good working knowledge of browser quirks and the ability to get even IE6 looking good (although you don't have to like it). It would help if you don't run away screaming from Javascript and can play well with the code monkeys. More details are below. Email the address at the bottom of the job description, and mention this blog! Job Description Would you like to do something genuinely useful with your client side development skills - UI, XHTML, CSS (JavaScript, AJAX) 2degrees is an exciting, fast-paced, well-funded Web2.0 environmental networking business based in Oxford. We're looking for a top-notch client-side developer eager to work with our talented team to evolve our django-based Web2.0 application to meet the demands of our members and corporate partners (Cisco, EDF, British Gas, IBM) 2degrees’ purpose is to accelerate the speed at which businesses are able to implement sustainability and carbon reduction strategies on a global scale. Our members include sustainability professionals from companies such as HSBC, Coca-Cola, BASF, Sony, Marks & Spencer, BP, Shell, Eurostar, Sainsbury’s, … -
Minimum cost for warming-up various frameworks(and more)
Minimum cost for warming-up various frameworks(and more) -
Weather App on Github
As promised, I put the code of the climate_change app online. For that reason, I created an account on github trying to use Git for the first time. This is also the first time I am using a distributed version control system, i.e. you can create branches of the project, develop the forks separately on different computers, and merge them in any order. There is no main centralized repository. The code on github that I uploaded is just one initial copy.I am still new to Git commands and workflows. You can share your knowledge with me. For example, maybe you know some good cheat sheet or writings about Git. Or you can try to fork the project I committed, change it somehow and then push for merging (not sure if I'm using correct jargon). I will share with you what I find interesting and useful about Git while learning it. -
QFT
Daniel Dvorkin: In every field which was once exclusively male, but is now no longer, it’s been claimed first, that no woman can perform alongside men; second, when the first claim is disproven, that hardly any woman can; and third, when the second claim is disproven, that maybe a few women can, but a majority lack the ability or the inclination. And every single time, as the residual sexism fades, the third claim is shown to be false as well. -
More Feeds
Just added Atom Feeds for post categories and post comments. They are available in the category detail and post detail views. -
More Feeds
Just added Atom Feeds for post categories and post comments. They are available in the category detail and post detail views. -
django-piston form validation -- part 3
In my previous post titled "Exploration of django-piston -- part 2" [1] I end the post by 2 open issues. This post will propose a solution to the first one:The validation errors are returned as a pseudo xml string.Bad Request <ul class="errorlist"><li>content<ul class="errorlist"><li>This field is required.</li></ul></li><li>title<ul class="errorlist"><li>This field is required.</li></ul></li></ul>To put it in other words I would prefer if django-piston return the validation errors of the form in the format specified in the request. JSON$ curl -u testuser:foobar -X POST -d content="This post is created using the api" http://127.0.0.1:8000/api/posts/?format=jsonBad Request {"title": ["This field is required."]}yaml$ curl -u testuser:foobar -X POST -d content="This post is created using the api" http://127.0.0.1:8000/api/posts/?format=yamlBad Request title: [!!python/unicode 'This field is required.']xml$ curl -u testuser:foobar -X POST -d content="This post is created using the api" http://127.0.0.1:8000/api/posts/?format=xmlBad Request <ul class="errorlist"><li>title<ul class="errorlist"><li>This field is required.</li></ul></li></ul>After a while reading the source of django-piston and poking around I have implemented this feature in my branch.The biggest hurdle was that for some reasons "form.errors" cannot be serialized directly.simplejson.dumps(form.errors)*** TypeError: is not JSON serializableIn order to work around this issue you need to force python to evaluate this proxy object.dict((key, [unicode(v) for v in values]) for key,values in form.errors.items())The last bit is … -
Weather App Tutorial. Part 5 of 5. Graph View
I had some problems with the internet, so I am posting this entry a little later that expected. But anyway, this is it - the final part of the tutorial about the weather app. You can read the first four parts here: 1, 2, 3, 4. Today I will show you how to display a chart with statistical data from the collected weather details.I googled a little to find out what charting system to use for this small project. And I found Open Flash Chart as an interesting solution. It's a flash-based charting system which uses Ajax requests to get the data for the graphs. That means that we'll need a view which will show the graphs and another view, which will provide the data. Each location will have its own page displaying a chart, so it would be nice to have URLs where each location would be accessed by a slug. We already have a field sysname which could be used here, but my best practice is to have separate fields for url slugs which might be changed at anytime and sysnames which should be defined once and not changed at all because the sysname binds an object with … -
Comments and an Atom Feed
Small update for this site: Comments are now working and there is an Atom Feed for the latest posts in this blog. The behaviour and the style of the comments is not very polished yet, but I’ll work on that later. I’ll also add more feeds, e.g. for post comments, categories and tags. -
Magic! Python! Django! Whee!
This blog is now run by Django. I didn’t really like Wordpress which I used before. And also I don’t like PHP anymore (I really liked it some years ago, but everything changed, when I learned Python …). When I told a friend that I wanted to switch from Wordpress to something else, he just said: «Use Django.» So I took a look at the Tutorial and was instantly thrilled. At first, I wanted to use an existing weblog app, but I also wanted to code an app for my own and since I din’t find a weblog app that I 100% liked, I just decided to write my own. So here it is (far from finished though)! Features so far: Basic post model (title, slug, pub date, modify date, status, category, HTML body) Post manager for post counts (per year, month, category (and tag)) Hierarchical category model – imho, this is the highlight of my app. Archive and Categories Some special template tags. Usage of a recursive template tag for the categories Unit- and doctests for the models and template tags Features to come: Comments Atom feeds Sidebar Static pages Trac integration for my projects Search Last.fm sidebar widget … -
Comments and an Atom Feed
Small update for this site: Comments are now working and there is an Atom Feed for the latest posts in this blog. The behaviour and the style of the comments is not very polished yet, but I’ll work on that later. I’ll also add more feeds, e.g. for post comments, categories and tags. -
Tuning the count method on a queryset
Some alternate ways to manipulate the pagination of Django query sets. -
Weather App Tutorial. Part 4 of 5. Template Tag
If you followed the first parts of the tutorial, you should have basic understanding how to create an app with models, set up administration, and retrieve data from third-party services. This part is about displaying collected data in any template using custom template tag.At first, we need to create a directory templatetags containing an empty __init__.py file in the climate_change directory.mkdir -p climate_change/templatetagstouch climate_change/templatetags/__init__.pyI will call the template library weather. So I have to create a file weather.py in climate_change/templatetags and define and register the template tag in that file. The template tag get_current_weather should display the current weather for a chosen location. To define what location you choose, you could refer to id, name or location_id, but none of them is appropriate for this reason. id and location_id are not remember-able and not informative enough, whereas the name might be changed to translate the city to another language or to add some more specifics and this change would detach the template tag from the location. For those reasons, it is best to create a new field sysname for the location model which would have a unique non-changeable value as a textual humanized identifier for templates.But wait! It's such a … -
Weather App Tutorial. Part 3 of 5. Management Command
As you might have noticed, this is a continuous tutorial about an app which regularly checks weather and reports how it changes throughout years. Previously I wrote how to start a project and define the models. The interestingness of the app starts now. I will show you how to import weather details from Yahoo! Weather using a management command. Management commands in Django are those which are recognized by manage.py and django-admin.py, e.g. syncdb, shell, runserver, etc. It's not difficult to inject your own custom commands for your app. We'll need one that will be set as a scheduled task to check the current weather. To create a management command, you have to create directories management/commands/ inside of your climate_change directory and create empty files __init__.py in each of them. mkdir -p climate_change/management/commands touch climate_change/management/__init__.py touch climate_change/management/commands/__init__.py Now I'll create a file climate_change/management/commands/check_weather.py which will aggregate the data from the feed. Just looking at the examples of Django core commands, you can find, that management-command modules should have a class Command with an overridden method handle_norargs which will have all the logic of the command. I found an example of importing weather from Yahoo! and will be using it here. … -
Atualizações de segurança lançadas
Atualizações de segurança lançadas -
Atualizações de segurança lançadas
Atualizações de segurança lançadas -
exploration of django-piston -- part 2
Djangocon 09 was really food for thought and this post follow my previous post about django-piston. I found the talk from Avi Bryant about his experience building Trendly [1].My take away of this talk was that they have a single HTML page with a lot of JS. The JS is the used to get the JSON data the JSON from the server. Unfortunately I am unable to find a link to a better description of its talk.My last post hopefully convince you that it is easy relatively easy to create a web api to your django application [2]. This Post aims to show you how you can create a page to list and create a blogpost.List and create a blogpostThe idea here is to reuse the web api that we have created in the previous article to build a web page. One of the interesting feature of django-piston is the decorator @validate(BlogpostForm, 'PUT'). It enables you to validate the data send to your server and it takes as input a django form. A longuer description of this feature is available here [4].The view cannot be simpler [5] :def create_ajaxy_post(request): form = BlogpostForm() return direct_to_template(request, template='edit_ajaxy_post.html', extra_context={'form':form} )The template is using …