djangotips
-
we just launched the latest member of the tweetips family! now you can follow @ for little bits of CSS goodness too.
3:10 PM Apr 7th
from web
-
via @: add "from __future__ import division" at the top of a .py file to force "true division" (no rounding)
10:10 AM Mar 17th
from web
-
via @: to delete *.pyc files, in .profile add: alias delpyc = 'find . -name "*.pyc"* -exec rm {} \;' to use "delpyc" in shell.
9:00 AM Mar 14th
from web
-
via @: give your model fields overly descriptive names, and always use help text. you'll thank yourself during maintenance. :)
9:00 AM Mar 13th
from web
-
via @: I like to use the JSON parser to parse arguments in custom Django template tags. It's available in django.utils.simplejson.
12:20 PM Mar 12th
from web
-
via @: Filters can reference fields on the model using the new F() object in 1.1: query.filter(qty_sold__lt=F('quantity'))
4:00 PM Feb 16th
from web
-
via @: you can create models in a separate "models" module instead of a models.py file by defining an app_label in your model Meta.
10:00 AM Feb 14th
from web
-
via @: You can use .as_sql() on a QuerySet to see the RAW SQL it uses. Quick way to debug some queries.
10:00 AM Feb 13th
from web
-
via @: Painless doctests debug tool Usage: >>> import interlude; interlude.interact(locals())
4:20 PM Feb 12th
from web
-
via @: Great first run django tutorial/how-to for new users. Illustrates building a to-do app from scratch.
10:23 AM Feb 9th
from web
-
note: context processors & middleware have different purposes that can solve the issue in different situations. that's why we shared both :)
6:52 PM Feb 6th
from web
-
via @: actually a custom context_processor is better for adding something like shopping_cart to every request, not middleware
4:10 PM Feb 6th
from web
-
via @: if you want something available to every request (like a shopping cart), custom middleware might be the answer
10:00 AM Feb 6th
from web
-
via @: to recursively remove all of your *.pyc files in a bash terminal, run: find . -name "*.pyc" -exec rm '{}' ';'
4:00 PM Feb 5th
from web
-
via @: quick inspection of a models fields: you can go through model._meta.fields, e.g [x.__dict__ for x in XY._meta.fields]
10:20 AM Feb 5th
from web
-
via @: is a better idea than bare "print." Much more flexible.
11:10 AM Feb 4th
from web
-
via @: add print "variable" in your views.py file and you can debug in terminal
10:00 AM Feb 4th
from web
-
via @: adopt the preferred file structure of benchmark Django apps as soon as possible, it lets you work very quickly
4:00 PM Feb 3rd
from web
-
via @: you can set all your forms to action="" to post a page to its own URL as long as your URL ends with a forward slash.
10:00 AM Feb 3rd
from web
-
via @: Fetch the latest entry within an object using Foo.objects.latest('field_name'). A neater way then slicing your query.
12:55 PM Feb 2nd
from web
|
- Name djangotips
- Web http://django.twe...
- Bio little bits of django goodness in 140 characters or less. and it's all powered by you, the django community. :) dm your tips to @djangotips!
|