I've been looking into Django more. I was wondering the best way to automatically return the correct response format for any given type of request. Specifically, I'm interested in distinguishing between html and json requests.

In the past I've just appended '/json' to a given url to get json data, but then I was curious how Rails seems to automatically know what the request format was. According to this:

http://stackoverflow.com/questions/6253826/how-does-rails-determine-incoming-request-format

"Rails determines the desired response format from the HTTP Accept header submitted by the client."

It looks like there is similar functionality in Django, but the routing is not as built in as in Rails.

From:
http://stackoverflow.com/questions/9262278/django-view-returning-json-without-using-template

You can use request.is_ajax(). But that requires that the HTTP_X_REQUESTED_WITH header is set. Most JavaScript libraries do this automatically, but if you're using some other type of client, you'll need to make sure it sets it as well. Alternatively, you can pass a querystring such as ?json with the URL and then check request.GET.has_key('json'), which is probably a little more foolproof.

More details are available here:
https://docs.djangoproject.com/en/dev/ref/request-response/

I usually don't remember the syntax for HTML forms. Inevitably, when I'm starting a project, I need to go look up the basics. Then, I usually reuse the template that I come up with and don't look back. Here are some notes on those basics...

There is a python module, webhelpers, that will help in generating form markup:
http://pypi.python.org/pypi/WebHelpers
http://webhelpers.groovie.org/

This also turns out to be a good reference for common html tags, even if you don't want to generate them:
http://webhelpers.groovie.org/modules/html/tags.html

center page content
http://www.reignwaterdesigns.com/ad/tidbits/hacks/css_center.shtml
This will only work if the DOCTYPE is XHTML Transitional or Strict. IT WILL NOT WORK if your doctype is HTML 4.x. Here is an example of what it should look like:



NEXT!
Put this at the top of your CSS file and you will be good to go!
#html, body {
top: 0px;
right: 0px;
bottom: 0px;
left: 0px;
width:980px;
height: 100%;
margin: auto;
}


there seem to be many approaches these days for blocks with rounded corners.

there was one fully CSS version that draws one line rows along the top and bottom of the block with margins to give the rounded effect:

The rest use 2-4 images to get the effect

http://www.google.com/search?hl=en&q=rounded+corners+css&btnG=Google+Search&aq=f&oq=
rounded corners css - Google Search
http://www.cssjuice.com/25-rounded-corners-techniques-with-css/
25 Rounded Corners Techniques with CSS
http://www.spiffycorners.com/index.php?sc=contact&bg=ffffff&fg=001b2c&sz=5px
Spiffy Corners - Purely CSS Rounded Corners



Deliverance does transformations of HTML to 'theme' pages, similar in function to XSLT but using a simpler XML-based language to express the transformation.

http://www.openplans.org/projects/deliverance/introduction
Deliverance Introduction - deliverance - OpenPlans
http://www.openplans.org/projects/deliverance/specification
Specification for Deliverance - deliverance - OpenPlans