Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
What's New With WhisperGifts
In the past couple of months I've done some fun and interesting stuff over at WhisperGifts, my side project that lets couples put their bridal gift registry online. It's all built with Django, so I thought I'd share a few neat things I've come across along the way. Bookmarket and … -
What's New With WhisperGifts
It's been a busy few months for WhisperGifts, my bridal gift registry service built with Django. This post rounds up a few recent additions and changes, including technical details for those who want to do something similar. Highlights include weather forecasting, REST APIs, and JavaScript bookmarklets. -
What's New With WhisperGifts
In the past couple of months I've done some fun and interesting stuff over at WhisperGifts, my side project that lets couples put their bridal gift registry online. It's all built with Django, so I thought I'd share a few neat things I've come across along the way. Bookmarket and image detection For a while I've had a bookmarklet to add any item to your registry, which basically took the page title, selected text (or meta description), and URL and pre-filled the Add Item form. Recently, I updated it to also find the largest image on the page, and add that as the default image for the item you selected. This makes it pretty quick to add an item from, for example, an Amazon page or a manufacturer's website. The code to do it was surprisingly simple. Apologies for the short variable names; this is taken directly from my bookmarklet code so brevity is a plus in that scenario. var ims=document.getElementsByTagName('img'); var imsMxD=0; var im=''; for(x=0;x<ims.length;x++){ var xDim=parseFloat(ims[x].width)*parseFloat(ims[x].height); if((xDim>imsMxD)&&(ims[x].src)){ imsMxD=xDim; im=ims[x].src; } } This will give me a variable, im, which contains the URL of the largest image on the page. I then pass this to the form to pre-populate … -
IP Street is hiring! Senior Developer (Python, Django)
Overview Founded in 2010, IP Street has built the world’s preeminent Intellectual Property(IP) analytics and visualization engine, in conjunction with a nationally recognized IP law firm. Our SaaS product helps corporations and financial analysts quickly and efficiently analyze IP information. We make IP data easy to get, use, and understand! As with any organization, we’ve continued to evaluate new ways to provide value to our clients. We’re evolving into a “SaaS+” model, which pairs our service with expert consultation to assist our clients in assessment and evaluation. Our focus remains on the financial and technology markets. Our technology stack is almost all open-source, with some nifty esoteric search technologies. Most of your work will be in Python and Django, in a Mac-based development environment, deploying to Linux. Other technologies include Postgres, Redis, and Solr. Our client-side code relies on Highcharts and Backbone. This is a “small b” big data firm. But since we’re a scrappy start-up, we don’t have a big firm’s resources. We compensate by hiring senior people who are self-directed, appreciate real-world development trade-offs, and have a can-do attitude. It’s OK to not know something if you’re eager and willing to learn it. We know that bad code … -
Django Extensions 1.3.11
We are happy to release: Django-Extensions Version 1.3.11 This brings the usual tons of fixes and improvements Get it at: https://pypi.python.org/pypi/django-extensions/1.3.11 Changes: Improvement: sqldiff, show differences for not managed tables Improvement: show_urls -f aligned, 3 spaces between columns Improvement: reset_db, support mysql options files in reset_db Fix: sqldiff, Fixed bug with --output_text option and notnull-differ text Fix: reset_db, Fix for PostgreSQL databases with dashes, dots, etc in the name Fix: dumpscript, AttributeError for datefields that are None Docs: Adding RUNSERVERPLUS_SERVER_ADDRESS_PORT to docs -
Related ManyToManyField in Django admin site
Hello everyone. There is something quite common people are trying to do in Django which is accessing a ManyToMany relationship from both ends in Django admin. Since this is something I am going to have to explain to someone tomorow, I thought I'd take the opportunity to write a short tutorial about it. -
Liquid Templates and Django Templates
Note to self: when I get the error: {% highlight rbcon %} /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/convertible.rb:81:in `do_layout': undefined method `name' for # (NoMethodError) from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/post.rb:189:in `render' from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/site.rb:193:in `render' from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/site.rb:192:in `each' from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/site.rb:192:in `render' from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/site.rb:40:in `_draft_process' from /Users/matt/Dropbox/Blog/_plugins/drafts.rb:15:in `process' from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/jekyll:250 from /usr/local/bin/jekyll:19:in `load' from /usr/local/bin/jekyll:19 {% endhighlight %} It's probably because I have used django template tags in the {% raw %}`{% (end)highlight %}`{% endraw %} blocks, and omitted the {% raw %}``{% (end)raw %}``{% endraw %} stuff. -
Leveraging HTML and Django Forms: Pagination of Filtered Results
Django's forms are fantastic for parsing user input, but I've come up with a nice way to use them, in conjunction with HTML forms, for pagination, using the inbuilt Django pagination features. It all stems from the fact that I've begun using forms quite heavily for GET purposes, rather than just for POST. Basically, anytime you have a URL that may have some parts of the query string that may need to be built, it's simpler to use a form element, than to manually build up the url in your template. Thus, where you may have something like: {% highlight html+django %} {% raw %} {% endraw %} {% endhighlight %} It may be better do do something more like: {% highlight html+django %} {% raw %} {% endraw %} {% endhighlight %} Indeed, you can even use named buttons for submission, which will refer to the page. That is the key to the process outlined below. * * * Django comes with lots of "batteries", including form handling and pagination. The Class Based Views (CBV) that deal with collections of objects will include pagination, although it is possible to use this pagination in your own views. For simplicity, we'll … -
Updated repository for the Babbler series
Hi everyone. This is just a short post to let you know that we have updated the repository for the Babbler tutorial series. Instead of using a different repository for each tutorial, we will now be using a single repository accessible from here. Each tutorial has its own branch and tags mark the start and end of each tutorial part. We have also uploaded the code for the last tutorial (Creating a custom user model in Django 1.6) since it was missing. Some time next week we will publish the next tutorial in the series: Creating re-useable apps. In the mean time: happy coding everyone -
My Talk "Django at scale" at Django London Meetup
On Tuesday I gave a talk on Django at the London Django Meetup Group, titled "Django at Scale." Here are my slides: Here are a few brief summaries of topics I covered, which I hope to cover in more depth with a blog post on each in the future: 1. Wrap Django's Classes For Your Project Sub-classing django's base classes, e.g. the Admin classes as in for, allows you to make whole codebase changes easily. It's not that much effort to implement and allows you to solve many problems easily. It's also an argument for class-based views. I've give a complete example of doing this in my post on extending querysets and the admin to return approximate counts. 2. Background-fill Your Cache The most common cache pattern for django is to test if the item is in the cache, and if it's not there, to run the slow function to generate it. Often this is a user dependent variable, e.g. the count of all the comments they've made. When you expand to a certain scale though, you're sure to see a user for whom this slow function takes just way too long no matter what. You can notice this by … -
My Talk "Django at scale" at Django London Meetup
On Tuesday I gave a talk on Django at the London Django Meetup Group, titled “Django at Scale.” Here are my slides: Here are a few brief summaries of topics I covered, which I hope to cover in more depth with a blog post on each in the future: 1. Wrap Django’s Classes For Your Project Sub-classing django’s base classes, e.g. the Admin classes as in for, allows you to make whole codebase changes easily. It’s not that much effort to implement and allows you to solve many problems easily. It’s also an argument for class-based views. I’ve give a complete example of doing this in my post on extending querysets and the admin to return approximate counts. 2. Background-fill Your Cache The most common cache pattern for django is to test if the item is in the cache, and if it’s not there, to run the slow function to generate it. Often this is a user dependent variable, e.g. the count of all the comments they’ve made. When you expand to a certain scale though, you’re sure to see a user for whom this slow function takes just way too long no matter what. You can notice this by … -
My Talk "Django at scale" at Django London Meetup
On Tuesday I gave a talk on Django at the London Django Meetup Group, titled "Django at Scale." Here are my slides: Here are a few brief summaries of topics I covered, which I hope to cover in more depth with a blog post on each in the future: 1. Wrap Django's Classes For Your Project Sub-classing django's base classes, e.g. the Admin classes as in for, allows you to make whole codebase changes easily. It's not that much effort to implement and allows you to solve many problems easily. It's also an argument for class-based views. I've give a complete example of doing this in my post on extending querysets and the admin to return approximate counts. 2. Background-fill Your Cache The most common cache pattern for django is to test if the item is in the cache, and if it's not there, to run the slow function to generate it. Often this is a user dependent variable, e.g. the count of all the comments they've made. When you expand to a certain scale though, you're sure to see a user for whom this slow function takes just way too long no matter what. You can notice this by … -
DjangoCon 2014 Ticket Giveaway
Caktus is giving away a DjangoCon ticket valued at $850. DjangoCon is the main US Django conference and it’s returning to Portland this year, August 30 - September 4th. Meet fellow Django developers, learn what others are doing, and have a good time! To enter the giveaway, (1) follow us @caktusgroupand and (2) retweet our message by clicking the button below: Tweet The giveaway will end Wednesday, August 20th at 9AM PDT. We’ll randomly select a name and alert the winner by 5PM PDT. Please note that only one entry per individual is allowed and winning tickets are non-transferable. We hope to see you at DjangoCon this year! -
DjangoCon Ticket Giveaway!
Update: Congratulations to @dmpayton for winning this giveaway! Caktus is giving away a DjangoCon ticket valued at $850! DjangoCon is the main US Django conference and it’s returning to Portland this year, August 30 - September 4th. Meet fellow Django developers, learn what others are doing, and have a good time! -
Hola, Argentina!
I'll be arriving in Argentina on August 14th. I'll be speaking at PyDay Mendoza on August 15th, and sprinting on August 16th on something Audrey and I named the "new library sprint" (more details to come). On August 22nd, I'll be speaking at the combined Buenos Aires Python, Django, and PyLadies Argentina meetup. Between the events I'll be working from the Eventbrite/Eventioz Argentina office. I'm extremely excited. I've wanted to go to Argentina for years. It's a beautiful country filled with magnificent culture, lovely architecture, great food, superb wine, and wonderful people. Speaking of which, I can't wait to finally put faces to people I've gotten to know over the internet. Hasta pronto! -
Hola, Argentina!
I'll be arriving in Argentina on August 14th. I'll be speaking at PyDay Mendoza on August 15th, and sprinting on August 16th on something Audrey and I named the "new library sprint" (more details to come). On August 22nd, I'll be speaking at the combined Buenos Aires Python, Django, and PyLadies Argentina meetup. Between the events I'll be working from the _Eventbrite / _Eventioz Argentina office. I'm extremely excited. I've wanted to go to Argentina for years. It's a beautiful country filled with magnificent culture, lovely architecture, great food, superb wine, and wonderful people. Speaking of which, I can't wait to finally put faces to people I've gotten to know over the internet. Hasta pronto! -
Review: Django Essentials
A month ago Dyson D'Souza from PacktPub approached me asking if I would be interested in reviewing Django Essentials. I am using Django for some time now - somewhen pre 0.96, I remember the 0.96 release for some reason, I think it was the length of the release cycle but I am not sure anymore - and I really wanted to see how the introduction resources changed, so this was a good chance. Samuel Dauzon does a really good job writing for people who are just starting to work with Django. Beside some history he manages to explain all important concepts and, this is something I especially like, transports them to the terminology used by Django. After explaining what MVC is he also explains what Django is calling the different parts and how they fit together. This is something I often missed when reading a blog post or skimming through another book. While it is a good introduction you should already now a little bit of Python to feel comfortable. The book is suggesting Python 3 which is in my opinion still a risky route to take for a beginner. While most libraries are ported you can still easily run … -
Review: Django Essentials
Review: Django Essentials A month ago Dyson D'Souza from PacktPub approached me asking if I would be interested in reviewing Django Essentials. I am using Django for some time now - somewhen pre 0.96, I remember the 0.96 release for some reason, I think it was the length of the release cycle but I am not sure anymore - and I really wanted to see how the introduction resources changed, so this was a good chance. Samuel Dauzon does a really good job writing for people who are just starting to work with Django. Beside some history he manages to explain all important concepts and, this is something I especially like, transports them to the terminology used by Django. After explaining what MVC is he also explains what Django is calling the different parts and how they fit together. This is something I often missed when reading a blog post or skimming through another book. While it is a good introduction you should already now a little bit of Python to feel comfortable. The book is suggesting Python 3 which is in my opinion still a risky route to take for a beginner. While most libraries are ported you can … -
Starting with django-allauth
There are a lot of ways to do authentication in django. You can do social authentication and/or django.contrib.auth authentication. Generally they are separate, but with django-allauth you can combine them both into one package. It even gives you a great jumping off place with plenty of other features. In this video learn how to start using django-allauth.Watch Now... -
Review Django Essentials
[Django Essentials](http://www.packtpub.com/web-development/getting-started-django). Note it appears the name of this book has been changed from "Getting started with Django". I'll be clear from the outset: I have some pretty strong issues about the first part of this book, and I'm going to be quite specific with the things that I think are wrong with it. Having said that, the later chapters are far better than the earlier ones. I am not sure, however, that it's any more accessible than the [official documentation](http://docs.djangoproject.org). There's probably a market for a more thorough tutorial than the one on the Django website, however, I'm not sure this book, as it stands, is that tutorial. How could this book be better? I think it gets bogged down providing detail in areas that are just not that important at that point in time. I also think it misses a good overview of the product that is being built: indeed it's never clear, even after completing the book, exactly what the product is supposed to do. In my opinion, the code examples are hard to read. This is a combination of the styling of the source code, and the layout. That bold, blue is quite jarring in comparison … -
Don't touch autocommit in Django
Great Sentry We have a sentry service running on our server. It’s built on the Django framework and helps us to monitor the logging messages. It works just like a charm. Disk out of usage However, after three months the service went online, suddenly our IT monitor system alerts that the disk is running out due to mysql, and the mysql is for sentry. 60G /var/lib/mysql/ibdata1 The ibdata1 continuously grows without purge. It contains huge MVCC data like UNDO_LOG, We have to dump/load the whole databases and set innodb_file_per_table to replace the big ibdata1 file. find the exception The dump is very slow, so I take a look at the data. I suprisely find the table sentry_message have 500M rows! most of them is like this - MySQLdb.connections in defaulterrorhandler DatabaseError: (1305, 'SAVEPOINT s47569297779632_x1 does not exist') episode And it’s for an invisible project - Sentry (Internal). What, invisible? Yes, because the our setup didn’t create a default superuser. Thanks mwaterfall, I use the following command to fix it. sentry --config=~/etc/sentry/sentry.conf.py repair --owner=mwaterfall show queries So back to the topic, where is the exception coming from? I open general log for mysql, and see the following 140806 11:01:32 2 Connect … -
Dance my puppets
In many traditional multiplayer text engines for MUD/MUSH/MU*, the player connects to the game with an account name that also becomes their character's in-game name. When they log into the game they immediately "become" that character. If they want to play with another character, they need to create a new account.A single-login system is easy to implement but many code bases try to expand with some sort of "account system" where a single login "account" will allow you to manage one or more game characters. Matthew “Chaos” Sheahan beautifully argues for the benefits of an account system in the April issue of Imaginary Realities; you can read his article here.Evennia and account systemsFirst a brief show of how Evennia handles this. We use the following separation:Session(s) <-> Player <-> Objects/Characters(s)The Session object represents individual client connections to Evennia. The Player is our "account" object. It holds the password hash and your login name but has no in-game existence. Finally we have Objects, the most common being a subclass of Object we call Character. Objects exist in the game. They are "puppeted" by Sessions via the Player account. From this separation an account system follows naturally. Evennia also offers fully flexible … -
OSCON 2014 & REST API Client Best Practices
Mark Lavin, Caktus Technical Director and author of the forthcoming LightWeight Django was recently at OSCON 2014 in Portland where he gave a talk on improving the relationship between server and client for REST APIs. OSCON, with over 3000 attendees, is one of the largest open source conferences around. I sat down with him to ask him about his time there. -
OSCON 2014 & REST API Client Best Practices
Mark Lavin, Caktus Technical Director and author of the forthcoming Django LightWeight was recently at OSCON 2014 in Portland where he gave a talk on improving the relationship between server and client for REST APIs. OSCON, with over 3000 attendees, is one of the largest open source conferences around. I sat down with him to ask him about his time there. Welcome back! This was your second year speaking at OSCON. How did you enjoy it this year? I enjoyed it. There’s a variety of topics at OSCON. It’s cool to see what people do with open source—there’s such a large number of companies, technologies, and approaches to solutions. There were great conversations and presentations. I especially liked Ignite OSCON where people gave really well-prepared 5 minute talks. I participated in the OSCON 5k [Mark received 5th place] too. There were a lot of people out. We went over bridges and went up and down this spiral bridge twice. That race was pretty late for me but fun [began at 9pm PST, which is 12AM EST]. Why did you choose REST API client best practices as a talk topic? It was something that came out of working on Django LightWeight. … -
Django Extensions 1.3.9
We are happy to release: Django-Extensions Version 1.3.9 This brings the usual tons of fixes and improvements Get it at: https://pypi.python.org/pypi/django-extensions/1.3.9 Changes: Feature: shell_plus, add --kernel option to start as standalone IPython kernel Feature: reset_db, Programatically determine PostGIS template Feature: sqldiff, add support for PointField and MultiPolygonField Test: renamed test app Fix: runserver_plus, --print-sql for Django 1.7 Fix: shell_plus, --print-sql for Django 1.7 Fix: show_urls, add support for functions that use functools.partial Fix: show_urls, add formatter for aligned output (will most likely become future default) Fix: shell_plus / notebook, support for Django 1.7 Docs: various fixes and improvements Cleanup: Remove work arounds for Django 0.96 and earlier