background preloader


Facebook Twitter


Python - Favorite Django Tips & Features. Django_session. Django_User. Django_apps. - Luc Stepniewski's Blog. In a Django project, I have a template that is used by two urls, which is quite common (generic views, using ‘create_object’ and ‘update_object’).

- Luc Stepniewski's Blog

The problem is that I had to add a supplementary menu just when the template is loaded from the ‘update’ generic view, and not from the ‘create’ generic view. Making the difference between the two urls calls at the template level is a problem because it’s managed by generic views, so the same template is used. Anyways, there are several possibilities: In, use the ‘template_name’ variable, where you can speficy a specific template for this url(). That is instead of using the default <model>_form.html. Another solution, is to find a way to use a variable in the template that would be different wether the template has been loaded by update_object or create_object. In our urlpatterns in, we can use the ‘extra_context‘ variable (takes a dictionnary as parameter). We can also use, in, the ‘context_processors’ variable. Pinax : Package List.


Django_cron. Confusion in Django admin, static and media files. Django_patterns. Django_rails. Django_restful. From Designer to Django’er in Six Weeks — djangocon-2011-notes v0.0.1 documentation. Django. A Guide to Testing in Django - Toast Driven. For many people, testing their Django applications is a mystery.

A Guide to Testing in Django - Toast Driven

They hear that they should be testing their code but often have no clue how to get started. And when they hit the testing docs, they find a deep dive on what functionality is available, but no guidance on how to implement. This is the first in a series of blog posts to try to help alleviate this & get everyone on the testing bandwagon. I'll assume you've never done any testing before but that you're comfortable with Python & Django. We'll be walking through adding tests to the perennial tutorial Django app. Before we dive into code, let's introduce some basic concepts & talk about how to think/go about testing. Why Should You Test Your Code? "Code without tests is broken by design.

" - Jacob Providing automated tests for your code is a way to repeatedly ensure, with minimal developer effort, that the code you wrote to handle a task works as advertised. This is not to say that tests solve everything. Types Of Testing Tooling.


Django_form. Django_ajax. 10 Insanely Useful Django Tips. There are quite a few great little tricks and tips one could use on their Django projects that would speed up development and save many headaches in the long run.

10 Insanely Useful Django Tips

From basic to obscure, these tips can help any skill-level of programmer become more adept with Django and all it's glory. Django is an excellent framework for Python. While it may not get as much ink as other popular frameworks like Rails, it is just as much a polished framework as any of the rest. It puts plenty of emphasis on the DRY principle (Don't Repeat Yourself) in clean coding by automating many of the processes in programming. For some reason, projects tend to be moved around in location from time to time.

Tutorials. Django Projects — Django Best Practices. Location Templates typically live in one of two places, inside the application or at the root level of a project.

Django Projects — Django Best Practices

We recommend keeping all your templates in the project template directory unless you plan on including your application in multiple projects (or developing it as a open source “reusable” application). In that case, it can be helpful to ship with a set of sample templates in the application, allowing it to work out-of-the-box or serving as an example for other developers. Naming. How and why to use django-mongokit (aka. Django to MongoDB) Here I'm going to explain how to combine Django and MongoDB using MongoKit and django-mongokit.

How and why to use django-mongokit (aka. Django to MongoDB)

MongoDB is a document store built for high speed and high concurrency with a very good redundancy story. It's an alternative to relational databases (e.g. MySQL) that is what Django is tightly coupled with in it's ORM (Object Relation Mapping) and what it's called now is ODM (Object Document Mapping) in lack of a better acronym. That's where MongoKit comes in. It's written in Python and it connects to the MongoDB database using a library called pymongo and it turns data from the MongoDB and turns it into instances of classes you have defined.


Django_videos. Django by Example: Django Tutorials - Django by Example. Django - Static file not found. (48) What does an ideal Django workflow setup look like. The Django Book: Version 2.0 (English) Five Days to a Django Web App: Day Three, Coding - The Daily Build. Thanks for coming back for Day Three!

Five Days to a Django Web App: Day Three, Coding - The Daily Build

[Note: Sorry this post is a day late. It was all ready to go late yesterday, but some of the code included below triggered a bug either in WordPress or ScribeFire and the whole post got mangled. I managed to resurrect it today from drafts, and I think it's coherent, but if you find some problem with it please drop me a note.] Progress So Far Yesterday we built some mockups, just HTML and CSS — nothing active. Armed with these mockups, we’re ready to get started coding. Foundation MySQL First, go to your web host’s control panel and create two MySQL databases for this project. You’ll get an error/warning if the test database exists when you first run tests. Set up the same databases on your local system: bash$ mysql -u root Welcome to the MySQL monitor. Then generate a skeleton for your project: startproject YOURPROJECT.

Then dive right in to and change a few things: Now it's time to generate the app: . Adding Some Meat bash$ . Documentation de Django — Documentation de Django 1.1.1. Index — Django Design Patterns. Le Framework Web python pour les perfectionnistes. Archives.