Create a list containing an arithmetic progression that can be iterated through in templates.
Emulate the [range](http://docs.python.org/library/functions.html#range) syntax.
You can use either numbers or variables.
Syntax:
{% num_range [start] stop [step] as some_range %}
{% for i in some_range %}
... do something
{% endfor %}
**About the author**:
Take a look at [my website](http://www.marcofucci.com)
This class generates a crows-foot notation ERD for your models (currently does not include fields) using GraphViz. The cardinality/modality of the relationships isn't perfect, but it works for 99% of cases out there.
A simple tag to render breadcrumbs.
Usage:
{% load breadcrumbs %}
{% breadcrumbs "['Home','Home','home']" "['Articles','Articles','articles']" "['object','object','object.get_absolute_url']" %}
Loads up the template in "modules/breadcrumbs.html" and renders it with a list of items.
You can provide the tag either with plain text stuff and named urls as the third argument ( any more arguments per bracket-block is parsed as args / kwargs for the reverse() call ) or the object directly, and the script tries after failing the reverse() to resolve the provided arguments.
Have pun.
TwitterBackend is the twitter authentication backend. This backend makes use of OAuth based "Sign-in with Twitter"
Configure your settings.py as per [Django - Specifying Authentication Backends](http://docs.djangoproject.com/en/dev/topics/auth/#specifying-authentication-backends)
If you want all the objects in your models' admin interface to have a direct link to their databrowse page (just like the *history* link).. follow these steps:
1) copy the *change_form.html* admin template in mytemplates/admin/
2) edit *change_form.html* by adding this code right next to (before or after) the following line (=the history button markup):
`<li><a href="history/" class="historylink">History</a></li>`
3) Make sure that all of you models are registered with [databrowse](http://docs.djangoproject.com/en/dev/ref/contrib/databrowse/)
That's it. Obviously if you don't want ALL the models to have this link, you should use a different recipe, for example this one: [http://www.djangosnippets.org/snippets/1016/](http://docs.djangoproject.com/en/dev/ref/contrib/databrowse/)
I was trying to implement the django inline drag & drop,
I cudn't understand. Then I have try with YUI library
Copy the above code in the respective .py & download the YUI library and add the JS in your media folder. This will do...,
Try this our , it's easy to use..,
While working on my website projects today I had the idea to use HTML/JS instead of a IP database to localize the dates and times shown on the websites.
Here are the snippets to use the JS snippets as filters for Django running on Google App Engine. You can use those filters on datetime objects.
This piece of code allows the quickly set the locale to a different language. This can be used for instance in cron jobs to send emails to users in their specific language.
This is pretty rough code, it be better to create an object, having two functions: set_locale and reset_locale. set_locale would than contain steps 1 to 4 (and return the request object on succes), reset_locale would be step 6
Enjoy!
This is based on snippets 29 and 43, both of which had good ideas, and I thought, "why not combine them?"
Given the new_topic string above, the resulting slug will be:
"test-long-string-which-has-many-words-here"
John Crawford
Note - requires python 2.5, for list comprehensions. Otherwise you could just use a for loop to build the clean_list.
This code creates a widget that we used to generate a list of radiobuttons as follows:
* Radio button 1
--Widget__1
* Radio button 2
--Widget__2
* Radio button 3
--Widget__3
How to use it is:
`ImagenForm class (forms.ModelForm):
widget1 = forms.BooleanField ()
widget2 = forms.TextInput
widget3 = forms.ModelChoiceField (queryset = Modelo.objects.all ())
widget4 = forms.FileInput
optConListas = ChoiceWithOtherField (choices = [(2, 'widget1' widget1), (3, 'widget2' widget3.widget), (4, "widget2" widget2), (5, 'widget4' widget4)])`
This model is designed for my webshop. The Client-object is very 'stretch-able' by defining more fields to the client. These extra fields ares stored in the ClientConfig-object.
Be sure to create a new Client-instance first and SAVE it! Without a client.id the ClientConfig won't work.