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)
`
Django allows you to specify your own ModelManager with custom methods. However, these methods are chainable. That is, if you have a method on your PersonManager caled men(), you can't do this:
Person.objects.filter(birth_date__year=1978).men()
Normally, this isn't a problem, however your app may be written to take advantage of the chainability of querysets. For example, you may have an API method which may return a filtered queryset. You would want to call with_counts() on an already filtered queryset.
In order to overcome this, we want to override django's QuerySet class, and then make the Manager use this custom class.
The only downside is that your functions will not be implemented on the manager itself, so you'd have to call `Person.objects.all().men()` instead of `Person.objects.men()`. To get around this you must also implement the methods on the Manager, which in turn call the custom QuerySet method.