Kozea/Radicale — pull request #180 by okami-1 (2014-06-29 10:40:13+00:00)
Title: django integration

It's possible to use radicale as a regular django application in any django project.

Difference in configuration:
1. All settings should be put in RADICALE_CONFIG dictionary inside django project setting.py instead of a config file.
2. "server" section is ignored (not sure about "base_prefix" and "realm" atm).
3. "auth" section has new option for "type" - "django", for authenticating using regular django users.
4. "storage" section has new option for "type" - "django", for using django models as a storage. It's possible to edit/view them using django admin web interface.
5. "rights" section has new rights handler "radicale.rights.django", for using rights configuration from RADICALE_RIGHTS inside django project setting.py.
6. "log" section is ignored, regular django LOGGING settings should be used instead.

Installation:
Put this in your project's settings.py:
```
RADICALE_CONFIG = {
"server": {
"base_prefix": "/",
"realm": "Radicale - Password Required",
},
"encoding": {
"request": "utf-8",
"stock": "utf-8",
},
"auth": {
"type": "django",
"custom_handler": "",
"htpasswd_filename": "/etc/radicale/users",
"htpasswd_encryption": "crypt",
"imap_hostname": "localhost",
"imap_port": "143",
"imap_ssl": "False",
"ldap_url": "ldap://localhost:389/",
"ldap_base": "ou=users,dc=example,dc=com",
"ldap_attribute": "uid",
"ldap_filter": "",
"ldap_binddn": "",
"ldap_password": "",
"ldap_scope": "OneLevel",
"pam_group_membership": "",
"courier_socket": "",
"http_url": "",
"http_user_parameter": "",
"http_password_parameter": "",
},
"git": {
"committer": "Radicale ",
},
"rights": {
"type": "custom",
"custom_handler": "radicale.rights.django",
"file": "~/.config/radicale/rights",
},
"storage": {
"type": "django",
"custom_handler": "",
"filesystem_folder": os.path.expanduser(
"~/.config/radicale/collections"),
"database_url": "",
},
}
```
This is basic recommended settings with a maximum of the options available. You don't need all of them, because some of the options is depended on each other. You can modify them as you want. You can use any available auth, storage, rights backends, not only the "django" ones.

Configuration for the "radicale.rights.django" handler can be changed by setting RADICALE_RIGHTS in your project's settings.py.
For example:
```
RADICALE_RIGHTS = {
"rw": {
"user": ".+",
"collection": "^pim/%(login)s\.vcf$",
"permission": "rw",
},
}
```
Put this line inside your urlpatterns in your project's urls.py:
```
url(r'^addressbook/', include('radicale.urls')),
```
You can replace "addressbook" with anything you want.