Skip to main content
# Django User Settings

## Installation
Install using `pip`:

```bash
pip install django-user-settings
```

## Requirements

**django-user-settings** requires these:
- django
- psycopg2

## Example

Put `user_settings` to `INSTALLED_APPS` in `settings.py` like this:

```python
INSTALLED_APPS= (
...
'user_settings',
)
```

**Optional:

If you don't use your User model, django-user-settings will use default django User model.

```python
from django.contrib.auth.models import User
```

Otherwise, you will need to add your User model to `AUTH_USER_MODEL` in `settings.py`:

```python
AUTH_USER_MODEL = 'myapp.MyUser'
```

Now, you are ready to use **django-user-settings**, start with importing:

```python
from user_settings.utils import get_user_setting, set_user_setting
```

```python
get_user_setting(key, default_value=None, **kwargs)
```
Return user's setting in Python's dictionary

**Arguments**

`key`: setting's name

`default_value`: if **django-user-settings** cannot find suitable settings, this will be set to value of this key

`**kwargs`:
```
'request': django's request

'uid': PK of user you want to get setting
```
If you pass both `request` and `uid`, **django-user-settings** will get settings of user with pk=`uid`.

If you pass only `request`, **django-user-settings** will get settings of current authenticated user.

If you pass `uid` = None, **django-user-settings** will get settings with no specific user.

```python
set_user_setting(key, value, **kwargs)
```

**Arguments**

`key`: setting's name

`value`: setting's value

`**kwargs`:
'request': django's request, we will use this to get current authenticated user.
'uid': ID of user whose settings will be saved.


If you pass both `request` and `uid`, **django-user-settings** will save settings for user with pk=`uid`.

If you pass only `request`, **django-user-settings** will save settings for current authenticated user.

If you pass `uid` = None, **django-user-settings** will save settings with no specific user.


Metadata

Release files for django-user-settings 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-user-settings 0.0.11
File Size Uploaded Provenance Actions
django-user-settings-0.0.11.tar.gz 4.4 kB Without provenance Details for django-user-settings-0.0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-user-settings 0.0.11
File Interpreter ABI Platform Actions
django_user_settings-0.0.11-py3-none-any.whl Python 3 none any Details for django_user_settings-0.0.11-py3-none-any.whl

Total release size: 12.9 kB

Release files / django-user-settings-0.0.11.tar.gz

Download URL django-user-settings-0.0.11.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d688a80dd8257e8f881aa734457515da5f7d63a5a9fcb8063189089cd03d1c14
BLAKE2b-256 checksum
How to use checksums
e33c6e2034a4f7011035fd3c8f7d3e191e91fe1611e3bafbd4d9ee8daac0b55f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.7

Release files / django_user_settings-0.0.11-py3-none-any.whl

Download URL django_user_settings-0.0.11-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dadedee5081ea3e7e42705d189d7d625d011f328ad0404585cfd118b39648f6
BLAKE2b-256 checksum
How to use checksums
94f88eeb78804a61b03cca795e7e55915cbcdcdcce6dc612846f462432b73f82
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.7

Security for django-user-settings 0.0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page