Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django GetOrCreateView
Today I decided to use the Django class based view (CBV) CreateView, but I wanted to avoid duplications and submit to the view from the front page of a site. The reason was for a simple newsletter signup form. This is what I cooked up and should work for Django 1.3, 1.4, and the forthcoming 1.5 release. Here is what I did: 1. Installed dependencies This version requires the following package to be pip installed into your virtualenv. django-extensions so we can have easy timestamps on models. This also needs to be added to your list of INSTALLED_APPS: INSTALLED_APPS += ( 'django_extensions', ) 2. Defined the model The model is really simple, and inherits from TimeStampedModel so we know when people signed up: from django.db import models from django_extensions.db.models import TimeStampedModel class NewsLetterSignup(TimeStampedModel): email = models.EmailField("Email") def __unicode__(self): return self.email 3. Wrote the view Here's the somewhat challenging part that forced me to dive into Django's source code. Even with the documentation work we've done over the past few months, it's clear we've got a long way to go. Because of that source code diving, for this blog post I really did my best to document why I did things … -
Los Angeles Open Source Sprint on Nov 4th!
Yet again, myself, Audrey Roy, and a small but elite cadre of volunteers are feverishly at work putting together another Los Angeles open source event. Our last effort went smashingly well, and like any good engineer, we're ready to scale up - this time to 150 attendees! LA Open Source #5 is a day long coding event for Open Source developers of all languages and skill levels to come and code like fiends. They'll be joined by dozens of either really smart coders or nice people like me. Sponsors are providing food, drinks, venue, and more! RSVP at http://www.meetup.com/LA-Hackathons/events/85658952/ I'll be there to: Co-lead the event with the assistance of the awesome Los Angeles technical community! Code like a fiend. I plan to work on core Django. Maybe some ember.js stuff too. And now to open the floor to questions... When and where? Where: Cross Campus (crosscamp.us) 820 Broadway Santa Monica, CA When: November 4th, 2012 10 AM to 9 PM Is this like a Hackathon? Yup. See http://en.wikipedia.org/wiki/Hackathon#Sprints What if I don't have a project of my own to bring? Should I come? Heck yeah! There will be a number of projects around that you can join and contribute … -
Los Angeles Open Source Sprint on Nov 4th!
Yet again, myself, Audrey Roy, and a small but elite cadre of volunteers are feverishly at work putting together another Los Angeles open source event. Our last effort went smashingly well, and like any good engineer, we're ready to scale up - this time to 150 attendees! LA Open Source #5 is a day long coding event for Open Source developers of all languages and skill levels to come and code like fiends. They'll be joined by dozens of either really smart coders or nice people like me. Sponsors are providing food, drinks, venue, and more! RSVP at http://www.meetup.com/LA-Hackathons/events/85658952/ I'll be there to: Co-lead the event with the assistance of the awesome Los Angeles technical community! Code like a fiend. I plan to work on core Django. Maybe some ember.js stuff too. And now to open the floor to questions... When and where? Where: Cross Campus (crosscamp.us) 820 Broadway Santa Monica, CA When: November 4th, 2012 10 AM to 9 PM Is this like a Hackathon? Yup. See http://en.wikipedia.org/wiki/Hackathon#Sprints What if I don't have a project of my own to bring? Should I come? Heck yeah! There will be a number of projects around that you can join and contribute … -
Django Contact Form with reCAPTCHA
How to add a reCAPTCHA field to the the Quixotix contact form. -
Multiple Databases in Django
Most of the challenges in the modern world of web development radicate in the one and only world that sounds like a trending topic: scalability. Most of us won't have huge scalability issue, let's be honest, we don't write a facebook or instagram every now and then, but we do have some large in-house applications that are used by a lot of users and need to handle huge amounts of data and one data base server isn't just enough, for that case Django give us support for multiple databases, but we need to configure a couple of things.Databases definitionsThe very first thing is tu define our databases in the settings.py file, only thing to have in mind is that we always need one named default, the names of the rest are up to you.DATABASES = { 'default': { 'NAME': 'db_name', 'ENGINE': 'django.db.backends.mysql', 'USER': 'mysql_user', 'PASSWORD': 's3krit' }, 'slave_name1': { 'NAME': 'db_name', 'ENGINE': 'django.db.backends.mysql', 'USER': 'mysql_user', 'PASSWORD': 'priv4te' }, 'slave_name2': { 'NAME': 'db_name', 'ENGINE': 'django.db.backends.mysql', … -
w00t: Nodejsconf Hackathon with great prizes! Last tickets: hurry up!
w00t: Nodejsconf Hackathon with great prizes! Last tickets: hurry up! There are still 30 nodejsconf and 4 nodejs beginner workshop tickets: hurry up! Hackathon Hackathon Hackathon!!! :) After the conference we’ll be waiting for you all at Talent Garden, a co-working space pretty close to the conference’s venue, for a little party with free beer and snacks, kindly offered by the jsDay’s guys, networking and chit-chats from 7pm to 9 pm. Once we’ll be all nice and happy (thx beer ;D) we’re gonna throw a “social” hackaton from 9 pm till the next day, November 11th, at 7 pm. Wait a sec, put down your smartphone and twitter, we’re not talking about social networks but socially helpfull stuff! Webforall, a non-profit organization founded by a group of passionate web developers that aims to bring professional web communication to other non-profits, will help with ideas and clues for those needing a little kick-start in the socially helpful field :) Ok this is not mandatory, but well, that’s the hackaton’s spirit so, if you’re able to put together a great piece of software in less than 24h and make it REALLY useful for the human kind that’s a total win! :) Don’t worry though, … -
w00t: Nodejsconf Hackathon with great prizes! Last tickets: hurry up!
w00t: Nodejsconf Hackathon with great prizes! Last tickets: hurry up! body,.backgroundTable{ background-color:#eeeeee; } #contentTable{ border:0px none #000000; margin-top:10px; } .headerTop{ background-color:#26292e; border-top:0px none #000000; border-bottom:0px none #FFCC66; text-align:center; padding:0px; } .adminText{ font-size:10px; color:#333333; line-height:200%; font-family:Helvetica; text-decoration:none; } .headerBar{ background-color:#26292e; border-top:0px none #333333; border-bottom:0px none #FFFFFF; padding:0px; } .headerBarText{ color:#333333; font-size:30px; font-family:Helvetica; font-weight:normal; text-align:left; } .postcardBarText{ color:#333333; font-size:30px; font-family:Helvetica; font-weight:normal; text-align:center; } .title{ font-size:24px; font-weight:bold; color:#4A8797; font-family:Helvetica; line-height:150%; } .subTitle{ font-size:14px; font-weight:bold; color:#000000; font-style:normal; font-family:Helvetica; } .defaultText{ font-size:12px; color:#333333; line-height:150%; font-family:Helvetica; background-color:#FFFFFF; padding:20px; border:0px none #FFFFFF; } .footerRow{ background-color:#26292e; border-top:0px none #FFFFFF; padding:20px; } .footerText{ font-size:10px; color:#666666; line-height:100%; font-family:Helvetica; } a,a:link,a:visited{ color:#17488a; text-decoration:underline; font-weight:normal; } .headerTop a{ color:#26292e; text-decoration:none; font-weight:normal; } .footerRow a{ color:#465F5D; text-decoration:underline; font-weight:normal; } body,.backgroundTable{ background-color:#26292e; } There are still 30 nodejsconf and 4 nodejs beginner workshop tickets: hurry up! Hackathon Hackathon Hackathon!!! :) After the conference we’ll be waiting for you all at Talent Garden, a co-working space pretty close to the conference’s venue, for a little party with free beer and snacks, kindly offered by the jsDay’s guys, networking and chit-chats from 7pm to 9 pm. Once we’ll be all nice and happy (thx beer ;D) we’re gonna throw a “social” hackaton from 9 pm till the next … -
DjangoCon 2012 Videos
DjangoCon 2012 Videos -
Open Source Contributions Come In All Shapes And Sizes
Open Source Contributions Come In All Shapes And Sizes -
How to Set Hijax with Django and jQuery
The main principle of progressive enhancement is that the markup, styling, and Javascript are separated. The site should be functional and browsable without Javascript, but when Javascript is activated, it can add additional functionality to the elements of a page. For example, it can hijack the default behavior of normal links replacing it with Ajax loading of just a specific part of the page. This type of progressive enhancement was called Hijax by Jeremy Keit. Hijax has the following benefits: Visitors can browse the content on any browser and on any platform. The content is indexable by search engines for each page. Open graph lets you share each page on Facebook with specific title, description and image. Let me show you an example of Hijax. Recently during my spare time I developed a simple collective storytelling game 1000 Words. Every participant at any point of a story has a chance to choose the continuation previously entered by someone else or to continue by his own words. It's like threaded comments where you see only one thread at a time. All continuations are browsable without Javascript and each of them has Open Graph set, so Google can index all variations of … -
django-statsd 0.3.8 - nose plugin
We use Statsd in combination with Django through django-statsd. The timing and profiling information it provides is really useful on a live site. The information can also be useful for debugging and developing locally, for example by exposing in django-debug-toolbar. How about unit tests? Well here's a nose plugin to expose that information. Combined with the patches inside django-statsd you can quickly get some useful information. Run your tests with the following plugin: --with-statsd You should (hopefully) get some nice information. This is the output when running with all the patches in solitude. ====================================================================== Statsd Keys | Number | Avg (ms) | Total (ms) ---------------------------------------------------------------------- cache.memcached.clear | 222 | 0.202703 | 45.000 cache.memcached.delete | 1 | 1.000000 | 1.000 cache.memcached.get | 7 | 0.428571 | 3.000 cache.memcached.set | 7 | 0.000000 | 0.000 db.mysql.default.execute | 572 | 0.575175 | 329.000 solitude.paypal.check-purchase | 3 | 0.666667 | 2.000 solitude.paypal.get-pay-key | 9 | 0.444444 | 4.000 solitude.paypal.get-refund | 5 | 0.000000 | 0.000 solitude.paypal.get-verified | 3 | 0.666667 | 2.000 solitude.paypal.ipn.validate | 11 | 0.000000 | 0.000 solitude.proxy.paypal.get-pay-key | 6 | 0.333333 | 2.000 ====================================================================== Statsd Counts | Number | Total ---------------------------------------------------------------------- solitude.paypal.post | 23 | 23 ---------------------------------------------------------------------- Ran 228 tests in … -
Django Transactional 0.5
A couple of days ago i released Django Transactional, a module for django that will make thing lot easier for common django ModelForm transactions. Today i extended it a bit and released 0.5, including these new functionality:Now it includes a base template so you don't need to create one, it will try to get your custom template and if it's not found it will use default one that just renders your form as_p in a form tag with id ModelForm.New mandatory key configuration 'include' which will be the dict used to format urls:'include': { 'app_or_nick1': ['model_or_nick1', 'model_or_nick2'], 'app_or_nick2': ['model_or_nick3', 'model_or_nick4'],} Improved url generation using 'include' key to get less 404 probabilities.If you want to contribute or just look at the code you can go to the bitbucket branch. And as usual, patches and feedback are welcome! -
PBS' Half the Sky Documentary Site Developed by Caktus
Earlier this year Caktus had the honor of working with Sonnet Media and PBS’ Independent Lens on the documentary, Half the Sky: Turning Oppression into Opportunity for Women Worldwide. Originally a best-selling book by Nicholas Kristof and Sheryl WuDunn, the book adapted into a two part documentary series. The documentary gives a voice to oppressed women around the world and brings a greater awareness to their struggles to the rest of the globe. Half the Sky also highlights a few of the amazing women who are directly making a change in their countries by community organizing and advocating for women’s rights through non-governmental organizations. Caktus enjoyed developing the Half the Sky website since it allowed us to build a dynamic user experience by integrating interactive maps and video streaming into the site. We also really enjoyed working on the site because of the important work that the Half the Sky documentary is trying to achieve. As a company, Caktus tries to actively seek out projects that do good in and was founded with that goal in mind. We are very honored and proud to be able to work on the project. Half the Sky is currently streaming on the site … -
Custom choices in Django admin
Allow custom choices in the Django admin in a select widget. -
Quick Tip on Setuptools
You are probably used to the default usage of Setuptools, for example the following command installs the latest Django version into your python installation or currently active virtual environment: easy_install django Sometimes you might need to install a specific version of a module. This is an example of installing Django 1.3.3: easy_install django==1.3.3 If you want to upgrade the existing installation to the latest version, you can do that with: easy_install -U django -
Community interest
It's fun to see a growing level of activity in the Evennia community. The last few months have seen an increase in the number of people showing up in our IRC channel and mailing list. With this has come a slew of interesting ideas, projects and MUD-related discussion (as well as a few inevitable excursions into interesting but very non-mud-related territory - sorry to those reading our chat logs).One sign of more people starting to actually use Evennia "for real" is how the number of bugs/feature requests have been increasing. These are sometimes issues related to new things being implemented but also features that have been there for some time and which people are now wanting to use in new and creative ways - or systems which noone has yet really used "seriously" before. This is very encouraging, especially since a lot of good alternative solutions, variations and edge cases can be ironed out this way. So keep submitting those Issues, people!The budding Evennia community consists of people with a wide variety of interests, skillset and ambition.There are quite a few people who sees Evennia as a great stepping stone for learning Python, or for getting experience with creating a … -
Rails for Django developers
My presentation at Pycon India 2012 Download it from here -
Automation, Fabric and Django – presentation
As a follow up post of Automated deployment with Ubuntu, Fabric and Django here are the slides from my presentation on topic “Automation, Fabric and Django”. Unfortunately there is no audio podcast but if there is interest I can add some comments about each slide as part of this post. Automation – fabric, django and more from Ilian Iliev If there is anything that need explanation feel free to ask. -
The future of moderator
The future of moderator -
The future of moderator
-
The future of moderator
-
Open graph and timeline sharing using Django Facebook
As many apps will find out today, Facebook is removing it’s offline_access permission on October 3rd. For most apps this will mean that many of your open graph shares start failing. Fashiolista has built up quite some experience with tweaking this and today we’ll be sharing some tips. The actual code we’re using has been included in the latest version of Django Facebook. 1.) Store and retry your shares There are several advantages of storing your open graph shares in the database. You get: Stats Error tracking Ability to retry individual shares Ability to retry a user’s shares if you get an updated token Ability to delete shares (since you store the Facebook object id) Especially the ability to retry shares was important to us. Django Facebook provides a convenient OpenGraphShare model to store all your shares in. Have a look at the example below: class DjangoModel: def share_to_facebook(self, graph=None): from django_facebook.models import OpenGraphShare #this is where the magic happens share = OpenGraphShare.objects.create( user_id=self.user_id, action_domain='fashiolista:love', content_type=content_type, object_id=self.id, ) share.set_share_dict(kwargs) share.save() result = share.send() Note that we store all info required for sharing to Facebook in the OpenGraphShare model. The actual Facebook API request is sent when you call share.send(). Using … -
Nested resources in Tastypie
More elegant approach to do nested resources in Django Tastypie and make authentication work while at it. -
Planning Our First ShipIt Day at Caktus
I'm delighted to write that last Friday, we announced we'll be trying our first "ShipIt Day" at Caktus in October. ShipIt Days, also known as FedEx Days, provide a time for the team to set aside what occupies us most days—building fantastic web applications using Python and Django for our wonderful clients—and pick up something new or scratch an itch that's been bugging us for awhile. We got the idea from the book Drive by Daniel Pink, and it was also suggested independently by a number of team members. Much of the reasoning and purpose behind our decision to try out a ShipIt day can be found in the guidelines we put together describing the event. So, without further ado, here's a copy of our ShipIt Day Guidelines as of September 28, 2012. Parts of the Guidelines have been shamelessly adapted from Atlassian's ShipIt Day FAQ and Six Feet Up's post on the outcome of one of their FedEx days. We'll be posting further updates again after our first day's completion and will almost certainly evolve this policy as we go. Thanks, and let us know your thoughts! Purpose Caktus needs to innovate. We need to devote resources to research, … -
Looking for a static blog engine? Try Acrylamid!
Several Pythonistas switched to a static blog this year. If you are also looking into static blog engines, give Acrylamid a go. Examples of persons that went static are e.g. Alex Clark, Daniel Greenfeld and Tarek Ziadé. What these guys have in common is that they all use Pelican. You could follow their example and use Pelican—and it’s probably a good choice—but I recommend you also at least have a look at Acrylamid. It is written in Python, quite easy to get up and running, it offers all a blog needs (articles, tags, lists of articles, pages and feeds) and the author quickly responds to issues, pull requests and questions. You can write your content in (amongst others) reStructuredText and Markdown. The templates can be Jinja2 or Mako. Acrylamid is already great. But it is also under active development so it will even get better! Disclaimer: Since today I use Acrylamid for this blog (more about that in the next article: migrating to Acrylamid). I also contributed some code to the project. So I might be a bit biased…