background preloader

Django

Facebook Twitter

Simple search in Django. Installation — django-disqus 0.4.1 documentation. Without pip, it’s still pretty easy.

Installation — django-disqus 0.4.1 documentation

Download the django-disqus.tar.gz file from django-disqus’ PyPI page, untar it and run: First, add disqus to your INSTALLED_APPS. You don’t need to run syncdb as there are no models provided. Next, add DISQUS_API_KEY and DISQUS_WEBSITE_SHORTNAME to your settings. You can get your API key here (you must be logged in on the DISQUS website). Example settings.py: INSTALLED_APPS = ( ... A free jQuery slideshow by Pixedelic. A simple slide This is the "simple anathomy" of a slide: Captions You can add a caption to the slide, just put a div with class "camera_caption" into the div above: <div data-src="images/image_1.jpg"><div class="camera_caption">The text of your caption</div></div>

a free jQuery slideshow by Pixedelic

15. AJAX, Django and JQuery — How to Tango with Django 1.5.4. To make the interaction with the Rango application more seamless let’s add in a number of features that use AJAX, such as: Add a “Like Button” to let registered users “like” a particular categoryAdd inline category suggestions - so that when a user types they can quickly find a categoryAdd an “Add Button” to let registered users quickly and easily add a Page to the Category AJAX essentially is a combination of technologies that are integrated together to reduce the number of page loads.

15. AJAX, Django and JQuery — How to Tango with Django 1.5.4

Instead of reloading the full page, only part of the page or the data in the page is reloaded. If you haven’t used AJAX before or would like to know more about it before using it, check out the resources at the Mozilla website: To simplify the AJAX components you can use a library like JQuery. To include JQuery within your application, in the static folder create a js folder and plonk the JQuery javascript file (jquery.js) here along with an file called rango-ajax.js, which will house our javascript code. Using Virtual Environments in Django. At first I was a little hesitant to virtual environments in Django.

Using Virtual Environments in Django

Not because I didn't think it was a good idea, but because it seemed like a lot of extra work. After finally spending some time learning more about it, I can tell you that overall it is pretty easy and I would highly recommend it for all Django development. Using Virtual environments not only makes rebuilding your environments easier, it also makes deploying to a service such as Heroku or Google App Engine possible.

Here is the general workflow I use when dealing with virtual environments. DebuggingImportError - PythonAnywhere. The theory When you say: Python will start by looking for a module named foo, and then inside that a module named bar, and then inside that for an object named baz (which may be a regular python object, or another module) A module is defined as:

DebuggingImportError - PythonAnywhere

Designing a RESTful Web API. Hacker News Discussion Purpose, Scope, Miscellaneous I decided to write this article to serve as my personal "quick start guide" for designing RESTful Web APIs.

Designing a RESTful Web API

As such, this document is concerned with the how rather than the why. For the latter, check the Bibliography. Css - Simple two column html layout without using tables. Python - Images from ImageField in Django don't load in template. Making queries. Once you’ve created your data models, Django automatically gives you a database-abstraction API that lets you create, retrieve, update and delete objects.

Making queries

This document explains how to use this API. Refer to the data model reference for full details of all the various model lookup options. Throughout this guide (and in the reference), we’ll refer to the following models, which comprise a Weblog application: Model field reference. This document contains all the gory details about all the field options and field types Django’s got to offer.

Model field reference

Field options The following arguments are available to all field types. All are optional. null. Widgets. A widget that is composed of multiple widgets.

Widgets

MultiWidget works hand in hand with the MultiValueField. MultiWidget has one required argument: Model field reference. This document contains all the gory details about all the field options and field types Django’s got to offer.

Model field reference

Field options The following arguments are available to all field types. Regular Expressions Cheat Sheet by DaveChild - Cheatography.com: Cheat Sheets For Every Occasion. A quick reference guide for regular expressions (regex), including symbols, ranges, grouping, assertions and some sample patterns to get you started. Development regex regular expressions programming Download the Regular Expressions Cheat Sheet 1 Page Your Download Will Begin Automatically in 5 Seconds.Close.

Regular Expressions Cheat Sheet at RegExCheatSheet.com. Django + skelJS / Static Files Issue / References to Images in CSS. The Django template language. Django’s template language is designed to strike a balance between power and ease. It’s designed to feel comfortable to those used to working with HTML. If you have any exposure to other text-based template languages, such as Smarty or CheetahTemplate, you should feel right at home with Django’s templates.

Philosophy If you have a background in programming, or if you’re used to languages which mix programming code directly into HTML, you’ll want to bear in mind that the Django template system is not simply Python embedded into HTML. This is by design: the template system is meant to express presentation, not program logic. The Django template system provides tags which function similarly to some programming constructs – an if tag for boolean tests, a for tag for looping, etc. – but these are not simply executed as the corresponding Python code, and the template system will not execute arbitrary Python expressions. Templates. How To Tango With Django — How to Tango with Django. The Django template language.