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
This is a simple module for use with django to make a per user
dropbox access simple
Requirements:
* standard django authentication
* django sessions enabeled
* dropbox python api
>> easy_install dropbox
To use this dropbox module you have to add the following configuration to your
settings.py file
`DROPBOX_SETTINGS = {
'app_key' : "insert key",
'app_secret' : "insert secret",
'type' : "app_folder",
}`
and of course to include it in INSTALLED_APPS
`INSTALLED_APPS = (
...,
'django_dropbox',
)`
to make a table to store personal access tokens for your users run
>> python manage.py syncdb
In your views you can import the dropbox_user_required decorator
to mark views that should recive the named parameter dropbox_client
`
from django_dropbox.decorator import dropbox_user_required
@dropbox_user_required
def myViewFunk(request, ..., dropbox_client):
file = ...
dropbox_client.put_file(file)
`