What's new in Django community blogs?


Feb 07 2016 [Archived Version] □ Published at Latest Django packages added

Yet another Django extension with set of generic reusable, pluggable mixins

Fresh Book for Django Developers

Feb 06 2016 [Archived Version] □ Published at DjangoTricks under tags  advanced architecture book commands deployment

This week the post office delivered a package that made me very satisfied. It was a box with three paper versions of my "Web Development with Django Cookbook - Second Edition". The book was published at the end of January after months of hard, but fulfilling work in the late evenings and on weekends.

The first Django Cookbook was dealing with Django 1.6. Unfortunately, the support for that version is over. So it made sense to write an update for a newer Django version. The second edition was adapted for Django 1.8 which has a long-term support until April 2018 or later. This edition introduces new features added to Django 1.7 and Django 1.8, such as database migrations, QuerySet expressions, or System Check Framework. Most concepts in this new book should also be working with Django 1.9.

My top 5 favourite new recipes are these:

  • Configuring settings for development, testing, staging, and production environments
  • Using database query expressions
  • Implementing a multilingual search with Haystack
  • Testing pages with Selenium
  • Releasing a reusable Django app

The book is worth reading for any Django developer, but will be best understood by those who already know the basics of web development with Django. You can learn more about the book and buy it at the Packt website or Amazon.

I thank the Packt Publishing very much for long cooperation in the development of this book. I am especially thankful to acquisition editor Nadeem N. Bagban, content development editors Arwa Manasawala and Sumeet Sawant, and technical editor Bharat Patil. Also I am grateful for insightful feedback from the reviewer Jake Kronika.

What 5 recipes do you find the most useful?


Feb 06 2016 [Archived Version] □ Published at Latest Django packages added


Feb 05 2016 [Archived Version] □ Published at Latest Django packages added


Feb 05 2016 [Archived Version] □ Published at Latest Django packages added

Django Fancy Cron Field

Feb 04 2016 [Archived Version] □ Published at Latest Django packages added

Funding testimonial: Divio

Feb 04 2016 [Archived Version] □ Published at The Django weblog

Divio is a flourishing international Python/Django development company.

Our success in software is utterly dependent on a number of things, and our head of accounting was kind enough to put figures on some of them:

  • up-to-date workstations and software for our team of developers: US$100’000
  • annual supply of coffee, tea and other refreshments: US$25’000
  • being able to rely on a solid, stable, secure and powerful web application framework: priceless

When we say our business is built on Django, we're not just talking about our web applications, we do literally mean our business. And almost unbelievably, Django, our stable rock, is free.

Thanks to Django, Divio was able to get started, and thanks to Django we've grown into a company with clients around the world, over 30 employees in four different countries, and a bright future.

Django was a bold choice in 2006, but Python/Django web development clearly had a bright future, even in those early days. We made the right judgement when we decided that Django’s power and reliability represented our future. Since then, the investment we made has been repaid many times over.

It's tempting to take Django for granted, but the fact is, we rely on it. What's more, we don't just need Django now, we need Django to keep on developing and improving too.

It really matters to us to support Django. Helping fund the DSF's Fellowship Programme has been an excellent way to do that, and we've benefitted directly from the improvements to Django's codebase that the Fellowship has made possible.

Django isn’t just our chosen web application framework.

Django is also a community of people and an ecosystem of skills and software. We need them too, so we also we fund and support:

  • the conferences (like DjangoCons, PyCons and others)
  • the projects (like Read the Docs)
  • the initiatives (like Django Girls)
  • … and more.

Funding Django is not an act of charity, it's an investment, and we do it because it's a way of securing our own future.

Every business that relies on Django is in the same position, and no doubt wants Django to remain solid and stable, secure and powerful, and priceless and free - so the only sensible thing to do is invest in it, by providing financial support to the Django Software Foundation and to its community.

Join our current corporate members today by reading the details of corporate membership and applying here.

Please share this post and help spread the word to your employer, colleagues, and companies who you know use and appreciate Django, so that we might bring them on board in support in 2016.

Current corporate members may also wish to write a similar testimonial. To be featured, or for general questions, suggestions, and to help us make introductions with great folks, please get in touch.


Feb 03 2016 [Archived Version] □ Published at Latest Django packages added

How to no-mincss links with django-pipeline

Feb 03 2016 [Archived Version] □ Published at Peterbe.com

This might be the kind of problem only I have, but I thought I'd share in case others are in a similar pickle.

Warming Up

First of all, the way my personal site works is that every rendered page gets cached as rendered HTML. Midway, storing the rendered page in the cache, an optimization transformation happens. It basically takes HTML like this:

<link rel="stylesheet" href="vendor.css">
<link rel="stylesheet" href="stuff.css">

into this:

/* optimized contents of vendor.css and stuff.css minified */

Just right-click and "View Page Source" and you'll see.

When it does this it also filters out CSS selectors in those .css files that aren't actually used in the rendered HTML. This makes the inlined CSS much smaller. Especially since so much of the CSS comes from a CSS framework.

However, there are certain .css files that have references to selectors that aren't in the generated HTML but are needed later when some JavaScript changes the DOM based on AJAX or user actions. For example, the CSS used by the Autocompeter widget. The program that does this CSS optimization transformation is called mincss and it has a feature where you can tell it to NOT bother with certain CSS selectors (using a CSS comment) or certain <link> tags entirely. It looks like this:

<link rel="stylesheet" href="ajaxstuff.css" data-mincss="no">

Where Does django-pipeline Come In?

So, setting that data-mincss="no" isn't easy when you use django-pipeline because you don't write <link ... in your Django templates, you write {% stylesheet 'name-of-bundle %}. So, how do you get it in?

Well, first let's define the bundle. In my case it looks like this:

  # Bundle of CSS that strictly isn't needed at pure HTML render-time
  'base_dynamic': {
        'source_filenames': (
        'extra_context': {
            'no_mincss': True,
        'output_filename': 'css/base-dynamic.min.css',

But that isn't enough. Next, I need to override how django-pipeline turn that block into a <link ...> tag. To do that, you need to create a directory and file called pipeline/css.html (or pipeline/css.jinja if you use Jinja rendering by default).

So take the default one from inside the pipeline package and copy it into your project into one of your apps's templates directory. For example, in my case, peterbecom/apps/base/templates/pipeline/css.jinja. Then, in that template add at the very end somehting like this:

{% if no_mincss %} data-mincss="no"{% endif %} />

The Point?

The point is that if you're in a similar situation where you want django-pipeline to output the <link> or <script> tag differently than it's capable of, by default, then this is a good example of that.

New eBooks Available for Subscribers

Feb 03 2016 [Archived Version] □ Published at tuts+

Do you want to learn more about data analysis with Python? How about iOS 9 game development, Django, or Swift 2? Our latest batch of eBooks will teach you all you need to know about these topics and more.

Our latest batch of eBooks

What You’ll Learn

In the past couple of months we’ve made 16 new eBooks available for Envato Tuts+ subscribers to download. Here’s a selection of those eBooks, and a summary of what you can learn from them.

1. Mastering Ansible

Ansible provides a simple yet powerful automation engine. Beyond the basics of Ansible lie a host of advanced features which are available to help you increase efficiency and accomplish complex orchestrations with ease.

Mastering Ansible provides you with the knowledge you need to understand how Ansible works at a fundamental level and leverage its advanced capabilities. You'll learn how to encrypt Ansible content at rest and decrypt data at runtime. You will gain detailed knowledge of Ansible workflows, explore use cases for advanced features, craft well thought out orchestrations, troubleshoot unexpected behaviour, and much more.

2. Getting Started With Python Data Analysis

With this book, we will get you started with Python data analysis and show you what its advantages are.

The book starts by introducing the principles of data analysis and supported libraries, along with NumPy basics for statistic and data processing. Next it provides an overview of the Pandas package and uses its powerful features to solve data processing problems.

Other subjects include a brief overview of the Matplotlib API, how to apply powerful packages in Python to process raw data into pure and helpful data using examples, and a brief overview of machine learning algorithms.

3. Arduino for Secret Agents

Q might have Bond’s gadgets, but he doesn’t have an Arduino (not yet at least). In Arduino for Secret Agents, find out how the tiny Arduino microcomputer can be used to build an impressive range of neat secret agent projects that can help you go undercover, and get to grips with the cutting-edge of the world of espionage.

This book isn’t simply an instruction manual—it helps you put your knowledge into action so you can build every single project to completion.

4. iOS 9 Game Development Essentials

Game development has always been a combination of programming and art, and mobile game development is no exception to this rule. 

Whether you are new to iOS and game development as a whole, or are an experienced programmer wanting to learn the latest features of the platform, iOS 9 Game Development Essentials will provide you with crucial insight into this widely used platform.

5. AngularJS Directives Cookbook

If you’re already using Angular, you probably recognize the power of directives to transform the way you understand and build your projects—but customizing and creating your own directives to harness AngularJS to its full potential can be more challenging. This cookbook shows you how to do just that. It’s a valuable resource that demonstrates how to use directives at every stage in the workflow.

Whether you’re looking for guidance to dive deeper into AngularJS directives, or you want a reliable resource, relevant to today’s web development challenges, AngularJS Directives Cookbook delivers everything you need in an easily accessible way.

6. Mastering Swift 2

Swift 2 features exciting enhancements to the original iteration of Swift, acting, as Apple put it, as “a successor to the C and Objective-C languages.” Mastering Swift 2 demonstrates how to get the most from these new features, and gives you the skills and knowledge you need to develop dynamic iOS and OS X applications.

7. Node.js Essentials

Node.js is simply a tool that lets you use JavaScript on the server side. But it actually does much more than that—by extending JavaScript, it allows for a much more integrated and efficient approach to development.

With Node.js Essentials, you’ll find everything you need to create a complete full-stack application with Node.js. It will help you harness JavaScript much more effectively—and in doing so, expand your confidence and capabilities as a developer.

8. Django by Example

Django is a powerful Python web framework designed to develop web applications quickly, from simple prototypes to large-scale projects. Django encourages clean, pragmatic design, and provides developers with a comprehensive set of tools to build scalable web applications.

Django by Example will walk you through the creation of four professional Django projects, teaching you how to solve common problems and implement best practices. After reading this book, you will have a good understanding of how Django works and how to integrate it with other technologies to build practical, advanced web applications.

Start Learning With a Yearly Subscription

Subscribe to Envato Tuts+ for access to our library of hundreds of eBooks. With a Yearly subscription, you can download up to five eBooks per month, in addition to our huge library of video courses, while the Yearly Pro subscription gives you unlimited access.

You can also find thousands of scripts, code snippets and app templates on Envato Market to help you with these subjects. For example, if you're interested in iOS 9 game development, browse through some of these iOS game app templates.


Feb 03 2016 [Archived Version] □ Published at Latest Django packages added

Writing Unit Tests for Django Migrations

Feb 02 2016 [Archived Version] □ Published at Caktus Blog

Testing in a Django project ensures the latest version of a project is as bug-free as possible. But when deploying, you’re dealing with multiple versions of the project through the migrations. The test runner is extremely helpful in its creation and cleanup of a test database for our test suite. In this temporary test database,...

Django releases issued: 1.9.2 (security) and 1.8.9 (bugfix)

Feb 01 2016 [Archived Version] □ Published at The Django weblog

In accordance with our security release policy, the Django team is issuing Django 1.9.2. This release addresses a security issue detailed below. We encourage all users of Django to upgrade as soon as possible. The Django master branch is also updated.

Today we've also issued a bugfix release for the 1.8 release series. Details can be found in the release notes for 1.8.9.

CVE-2016-2048: User with "change" but not "add" permission can create objects for ModelAdmin’s with save_as=True

If a ModelAdmin uses save_as=True (not the default), the admin provides an option when editing objects to "Save as new". A regression in Django 1.9 prevented that form submission from raising a "Permission Denied" error for users without the "add" permission.

Thanks Myk Willis for reporting the issue.

Affected supported versions

  • Django master development branch
  • Django 1.9

Django 1.8 is not affected. Per our supported versions policy, Django 1.7 and older are no longer receiving security updates but are also unaffected.


Patches have been applied to Django's master development branch and to the 1.9 release branch, which resolve the issue described above. The patches may be obtained directly from the following changesets:

The following new release has been issued:

The PGP key ID used for these releases is Tim Graham: 1E8ABDC773EDE252.

General notes regarding security reporting

As always, we ask that potential security issues be reported via private email to security@djangoproject.com, and not via Django's Trac instance or the django-developers list. Please see our security policies for further information.

Your Django Story: Meet Safia Abdalla

Feb 01 2016 [Archived Version] □ Published at Django Girls Blog

This is a post in our Your Django Story series where we highlight awesome ladies who work with Django. Read more about it here.

Image of Safia Abdalla, Python developer

Safia Abdalla is an energetic software engineer with an interest in data science for social good and delicious coffee. She is the organizer of PyData Chicago and the founder of dsfa, a consulting company providing data science services to small and medium local businesses. Safia is also a frequent conference speaker and open-source contributor who’s passionate about helping others to reach their maximum potential. Her next talk, Popping Kernels: An Exploration of Kernel Development for Jupyter Notebooks, is this weekend at PyTennessee.

How did your story with code start?

As someone who started programming at a very early age, I get asked this question a lot! I actually started programming the summer before I started high school. I was really into documentaries and ended up watching a documentary series on the history of computing. Part of the series covered Google and I was extremely fascinated by how the search engine worked and how it was built. I ended up teaching myself how to program just so I can start building my own search engines. If you are curious for more details, I ended up writing the entire story of how I got into tech in a blog post on my blog.


What did you do before becoming a programmer?

Before programming, I was interested in all things theatrical. I was interested in either being a film actress or a lawyer. Mind you, I was around 12 years old at the time. Perhaps the best answer is before I was a programmer, I was just another kid.


What do you love the most about coding?

I love the zen and purpose associated with building software. You’ve probably heard many programmers get excited about how software inspires them to problem solve, but it’s absolutely true. Right now, in this very moment, as you are sitting on your computer reading this article you have the ability to open a text editor and a terminal and build something that disrupts the status quo of our world. That’s a super power if I’ve ever heard of one. People often say that the pen is mightier than the sword, but both of these tools have got some tough competition in the form of a computer.


Why Django?

Django was one of the first web frameworks that I tinkered with because the barrier to entry was so low. There is a strong community around the project, plentiful resources, and tons of example code. This “trifecta” of sorts makes it very easy for first time web programmers to get familiar with the fundamentals of MVC and the art of building for the web. More importantly, it makes it easy for people to take the knowledge they gain working with Django and apply it to other web frameworks.


What cool projects are you working on at the moment/planning on working on in the near future?

My current cool project is probably my startup. I’m starting a consulting company that provides data science consulting services to small and medium local businesses. I started this company after realizing the increased relevance and popularity of local businesses in communities and the increased demand for intelligent, data-driven experiences in all of our interactions. If you’re interested in how data science can be used to uplift communities, feel free to check out our website or send me an email!


What are you most proud of?

I’m most proud of the tech community development work that I’ve done in the city of Chicago and beyond. I teach tons of classes on data science and machine learning and web development. It warms my heart to hear the feedback that I receive from my students and the impact that I make on their journey through tech.


What are you curious about?

From a purely technical perspective, I’m dying to get my hands dirty with the Julia programing language. From a non-technical perspective, I’m interested in starting to participate in triathlons. Pretty crazy, I know, but that’s me!


What do you like doing in your free time? What’s your hobby?

I love to work out! Nothing feels better than working up a sweat and pushing the limits of my body. Working out is a lot like writing software. You’d be surprised by how malleable your body is. You can see results after just a few days of daily, rigorous workouts. Software is the same way.

I realize that I somehow reverted to talking about software in a question about my free time — I guess building software is a hobby of mine as well!

In addition to working out, I like to see films in the cinema and discover new music to obsess over.


Do you have any advice/tips for programming beginners?

Push yourself every day. Keep a daily blog where you share interesting discoveries. Your posts don’t have to be profound or viral, they just have to mean something to you. Start with one introductory book and stick with it. Don’t ask people what worked for them, ask people what didn’t work for them. It’s a long journey, but it’s a worthwhile journey. There is no such thing as “an expert,” we are all learning. Live long and prosper!


How did attending a Django Girls workshop influence your life/career? What did you get out of attending a Django Girls workshop?

I haven’t attended a DjangoGirls event as a participant but I have attended one as a volunteer with PyLadies Chicago. It’s always exciting to see the dedicated volunteers and the eager students at events like this. Although it didn’t shift any existing thinking I had about the Python community or my career, it confirmed the fact that people in our community truly care about Django and Python, whether they are teaching it or learning it.


Thank you so much, Safia!


If you would like to suggest someone to be featured in the Your Django Story series (or would like to nominate yourself!), please email us at [email protected]!


Adrienne Lowe


A Smooth Refresher on Python's Dictionaries

Feb 01 2016 [Archived Version] □ Published at tuts+

In a previous tutorial, I talked about a very versatile and flexible object type in Python, namely Lists. In this article, I continue my refreshers with another flexible Python object type called Dictionaries (also called associative arrays or hashes). Like the List, the Dictionary is an important concept to grasp in order to move forward in your Python journey.

What Is a Dictionary Anyway?

If you went through the Lists article, it will be easy to understand the concept of Dictionaries. They are pretty much like Lists but with two main differences: 

  1. They are unordered sets (unlike Lists which are ordered).
  2. Keys are used to access items and not a position (i.e. index).

Each key in the Dictionary has a value, which could be of any Python object type. That is, Dictionaries can be considered as key-value pairs. But, be careful that keys cannot be of types List or Dictionary.

Let's Create an English-French Dictionary

As we saw in the previous section, a Dictionary is simply an unordered set of key-value pairs. Let's use this concept to create our first example, an English-French dictionary. This Dictionary can be created as follows:

english_french = {'paper':'papier', 'pen':'stylo', 'car':'voiture', 'table':'table','door':'porte'}

The Dictionary english_french contains five English words set as keys with their French meanings set as values

Let's say we wanted to know how to say pen in French. We simply do the following:


where you will get stylo as the value returned.

Making Things More Interesting

Let's say we had a french_spanish Dictionary with the same words we had in the english_french Dictionary, as follows:

french_spanish = {'papier':'papel', 'stylo':'pluma', 'voiture':'coche', 'table':'mesa', 'porte':'puerta'}

Well, you have been asked how to say door in Spanish, and you don't have an English-Spanish dictionary on hand! But, don't worry, there is a solution. Consult your english_french Dictionary for the word, then use the result to consult the french_spanish Dictionary. Got the point? Let's see how we can do that in Python:


The result should be puerta. Isn't that very nice? You just got the word for door in Spanish although you don't have an English-Spanish dictionary.

More Operations on Dictionaries

In the previous example we saw how we can create a Dictionary and access items in the Dictionary. Let's see some more operations we can make on Dictionaries. I'm going to use the english_french Dictionary in the examples below.

How Many Entries Are There in the Dictionary?

In other words, this operation is meant to return the number of key-value pairs in the Dictionary. This can be performed using the len() operator, as follows:


You should get 5 returned.

Deleting a Key

The deletion of an item in a Dictionary is carried out through the keys. For instance, let's say we wanted to delete the word (key) door from the Dictionary. This can be simply done as follows:

del english_french['door']

This will remove the key door along with its value porte.

Does the Key Exist in the Dictionary?

In the previous sub-section, we removed the key door from the Dictionary. If we want to check if door still exists in the Dictionary or not, we type:

'door' in english_french

which should return False.

Thus, what do you think the following statement will return? Go ahead and give it a try (notice the not).

'door' not in english_french

What happens if we try to access a key that doesn't exist in a Dictionary? Say english_french['door']. In this case, you would get an error similar to the following:

Traceback (most recent call last):

  File "dictionary.py", line 7, in <module>

    print english_french['door']

KeyError: 'door'

Creating a Copy of Your Dictionary

You may need a copy of your english_french Dictionary and assign that to another Dictionary. This can be simply done using the copy() function, as follows:

new_english_french = english_french.copy()

Nested Dictionaries

As we mentioned above, values in Dictionaries can be of any type, including Dictionaries. This is referred to as Nesting. An example of this can be as follows:

student = {'ID':{'name':'Abder-Rahman', 'number':'1234'}}

Thus, if you type student['ID'], you should get:

{'name': 'Abder-Rahman', 'number': '1234'} 

Iterating Over a Dictionary

Let's come back to the english_french Dictionary. There are many ways in which you can iterate over the Dictionary's items:

for word in english_french:

    print word

The result of this statement is as follows:






Notice that the keys in the result are not given in the same order as in the english_french Dictionary. You can now see why I said that Dictionaries are considered unordered sets.

Another way of iterating through keys is as follows:

for word in english_french.iterkeys():

    print word

Notice that we used the iterkeys() function. A similar function that can be used to iterate through the values, namely itervalues(), is as follows:

for meaning in english_french.itervalues():

    print meaning

The result in this case should look something like the following:






Alternative Ways of Creating Dictionaries

There are alternative ways of creating a Dictionary in Python using the dict constructor. Some examples of creating the same Dictionary ID using dict are as follows:

ID = dict(name = 'Abder-Rahman', number = 1234)

ID = dict([('name','Abder-Rahman'),('number',1234)])

ID = dict(zip(['name','number'],['Abder-Rahman',1234])) # keys and values as Lists

There is more that you can do with Dictionaries. Check Python's documentation for more information.

django-planet aggregates posts from Django-related blogs. It is not affiliated with or endorsed by the Django Project.

Social Sharing


Tag cloud

admin administration adsense advanced ajax amazon angular angularjs apache api app appengine app engine apple application security aprendiendo python architecture articles asides audrey authentication automation backup bash basics binary bitbucket blog blog action day blogging book books buildout business cache capoeira celery celerycam celerycrawler challenges chat cherokee choices class-based-views cliff cloud cms code codeship coding command community computer computing configuration continuous deployment continuous integration couchdb coverage css custom d data database databases db debian debugging deploy deployment deployment academy design developers development devops digitalocean django django1.7 django cms djangocon django-nose django-readonly-site django-rest-framework django-tagging django templates django web framework tutorials documentation dojango dojo dotcloud dreamhost dughh easy_install eclipse education elasticsearch email encoding english error events extensions fabric facebook family fashiolista fedora field file filter fix flash flask form forms frameworks friends fun gae gallery games geek general gentoo gis git github gmail gnome google google app engine guides gunicorn hack hackathon hacking hamburg haskell heroku holidays hosting howto how-to how-tos html http i18n image imaging indifex install installation intermediate internet ios iphone java javascript jobs journalism jquery json justmigrated linear regression linkedin linode linux login mac machine learning mac os x math memcached mercurial meta migration mirror misc model models mod_wsgi mongodb months mozilla multi-language mvc mysql nelenschuurmans newforms news nginx nodejs nosql ogólne openshift opensource open source open-source orm osx os x ottawa paas packages patterns pedantics pelican performance personal philosophy php pi pil pinax pip piston planet plone plugin pony postgis postgres postgresql ppoftw presentation private programmieren programming programming &amp; internet project projects pycon pygrunn pyladies pypi pypy python python3 queryset quick tips quora rabbitmq rails rant ratnadeep debnath redis refactor release request resolutions rest reusable app review rtnpro ruby ruby on rails scala scaling science screencast script scripting security server setup simple smiley snaking software software collections software development south sphinx sql ssh ssl static storage supervisor support svn sysadmin tag tag cloud talk nerdy to me tastypie tdd techblog technical technology template templates template tags test testing tests tip tips tools tornado transifex travel tumbles tutorial tutorials twisted twitter twoscoops typo3 ubuntu uncategorized unicode unittest unix use user authentication usergroup uwsgi uxebu virtualenv virtualenvwrapper web web 2.0 web application web design &amp; development webdev web development webfaction whoosh windows wordpress work workshop yada znc