Observation: depends on jQuery to works!
This widget works like other multiple select widgets, but it shows a drop down field for each choice user does, and aways let a blank choice at the end where the user can choose a new, etc.
Example using it:
class MyForm(forms.ModelForm):
categories = forms.Field(widget=DropDownMultiple)
def __init__(self, *args, **kwargs):
self.base_fields['categories'].widget.choices = Category.objects.values_list('id', 'name')
super(MyForm, self).__init__(*args, **kwargs)
- newforms
- multiple
- forms
- jquery
- select
- widget
This is just a modified version of a [previous snippet](http://djangosnippets.org/snippets/1364/) to make it work with unicode and with class-based ListView paginator_class
To use it put this in your urls.py:
`from youapp.fileyouchose import NamePaginator`
`urlpatterns = patterns('',`
`url(r'^example/(?P<page>[0-9]+)/$', ListView.as_view(model=myModel,template_name="mytemplate.html",paginator_class=NamePaginator,paginate_by=25), name="url_name"),`
And then in your template something like this would work:
{% if page_obj.has_other_pages %}
<div class="row">
<div class="span12">
<div class="pagination">
<ul>
{% if page_obj.has_previous %}
<li><a href="{% url page page=page_obj.previous_page_number %}">Prev</a></li>
{% else %}
<li class="disabled"><a>Prev</a></li>
{% endif %}
{% for p in page_obj.paginator.pages %}
<li {% if p == page_obj %}class="active"{% endif %}>
<a href="{% url category_page page=p.number %}">{{ p }}</a>
</li>
{% endfor %}
{% if page_obj.has_next %}
<li><a href="{% url page page=page_obj.next_page_number %}">Next</a></li>
{% else %}
<li class="disabled"><a>Next</a></li>
{% endif %}
</ul>
</div>
</div>
</div>
{% endif %}
- django
- pagination
- listview