background preloader

Django

Facebook Twitter

5. Introduction to Django — Documentation. 6. Django Forms — Documentation. Django and AJAX: Dajax. Tutorial for: Dajax Requirements: Dajax enables you to build web applications using only Python code and HTML, with little to no JavaScript required.

Django and AJAX: Dajax

This is the third and final tutorial in the Django and AJAX set. This tutorial will focus on building a simple application which uses Dajax to load data from a model and update data back into a model. This tutorial will use some JavaScript, mainly to build the request required when updating or querying objects. Doing things with Django forms. By : Shabda Raaj Forms are one of the best features of Django.

Doing things with Django forms

(After models, admin, url routing etc :) ). Here is a quick tutorial describing how to do things with Django forms. Basic form Prob. Ans. Class UserForm(forms.Form): username = forms.CharField() joined_on = forms.DateField() This wil take care that the form is displayed with two text field, and a value for them are filled in, and the second field has correct formatting for a date. Prob. Ans. Class UserForm(forms.Form): username = forms.CharField() plan = forms.ModelChoiceField(queryset = Plan.objects.none()) def __init__(self, subdomain, *args, **kwargs): self.default_username = default_username super(UserForm, self). Here in the __init__ we are overriding the default queryset on field plan.

However the self.fields is populated only after super(UserForm, self). Prob. Ans. You could have called this method anything, but this is generally called save, to maintain similarity with ModelForm. Two-Faced Django Part 5: JQuery Ajax. We've been spending a lot of time together recently, and you're probably wondering if I'm going to quit writing this series before covering any Ajax at all.

Two-Faced Django Part 5: JQuery Ajax

That is a very valid concern. But, be reassured, this segment of the tutorial is going to cover using JQuery to implement Ajax voting in our web app. If you haven't followed along with the previous articles, grab the snapshot of the current progress of our project. Adding JQuery to the web app The first thing we need to do is download JQuery.

Var x = m45(k32, a32);n41(x); Dajaxproject.com - easy to use ajax libraries for django. AJAX. Pdb: Using the Python debugger in Django - Minutiæ by Mike Tigas. A couple conversations I had at DjangoCon last week reminded me that I’d never gotten around to finishing this little post.

pdb: Using the Python debugger in Django - Minutiæ by Mike Tigas

Since I started taking my first iOS development baby steps last year, I’ve become quite dependent on breakpoints and stepping as part of my Objective-C debugging workflow. …And yet, in Python/Django — the stack I spend most of my time working with — I’d stuck to the poor habit of throwing print statements around any found exceptions — for example, to figure out what lies in request.POST for a Django view.

And then I came across and started tinkering with pdb. Here’s a brief overview on how to rock your Python debugging workflow by using an actual interactive debugger. The Django Book. How I Learnt enough Python/Django to be Dangerous in 1 Month. Reading the umpteeth ‘Son, you need to learn to code if you’re going to be a web startup founder’ article I knew it was the first step I had to take.

How I Learnt enough Python/Django to be Dangerous in 1 Month

After all, it makes perfect sense right? You have a vague product idea which you want to turn into a prototype or even possibly a V1; you’re either going to need to pay a good developer market rates to do it for you (1000s of dollars of precious startup capital with no guarantee the output will be satisfactory) or you could do it yourself. There is no ‘Technical Co-founder’, it’s a mythical creature that never makes itself known to mere ‘Ideas Guys’. There are just ‘Co-founders’ and all of them need to be building the product at least in the early days.

This is how I went about picking up the skills I required in 1 month. Week 1: Familiarizing Myself with Python Every man and his dog are building their applications in either Python or Ruby. My first port of call was Google’s Python Class.