Profile
Achievement


magicrebirth's Recent Snippets
- All /
the plugin model in JQuery takes advantage of JavaScript’s prototype inheritance and makes it trivially easy to add new chainable methods
1
909
posted 15 years ago by magicrebirth
Python allows for strings to be formatted using a predefined format string with a list of variables.
The following is an example of using multiple format strings to display the same data:
0
763
posted 15 years ago by magicrebirth
The lambda operator built in to the Python language provides a method to create anonymous functions. This makes it easier to pass simple functions as parameters or assign them to variable names. The lambda operator uses the following syntax to define...
1
726
posted 15 years ago by magicrebirth
Scoping in Python revolves around the concept of namespaces. Namespaces are basically dictionaries containing the names and values of the objects within a given scope. There are four basic types of namespaces that you will be dealing with: the global...
0
910
posted 15 years ago by magicrebirth
example: a method on a model that outputs a list of tuples with (attribute_name.verbose, attribute_value)
0
1028
posted 15 years ago by magicrebirth
// Is there a way in python to convert a list say [1,2,3,4] to a string and
// also how to convert a string to a list?
// use str() or repr() to convert to a string.
// eval() will convert back to a list.
0
716
posted 15 years ago by magicrebirth
First: create a file under djangoapp/templatetags where you define your tags [e.g.: myadmin_tags.py]:
Second: create the html snippets that get loaded in those tags [e.g., personfactoid_info.html]:
Third: in mytemplates/admin/ modify change_for...
1
1149
posted 15 years ago by magicrebirth
This function takes anything which can be dumped into JSON and returns an HTTP response of it, with the right Content-type header.
2
957
posted 15 years ago by magicrebirth