semvec/pypi-packages huggingface dataset:
django-abstract-user 2021.6.7
Django AbstractBaseUser model without any fields
License: Unlicense

[![](https://img.shields.io/badge/released-2020.7.2-green.svg?longCache=True)](https://pypi.org/project/django-abstract-user/)
[![](https://img.shields.io/badge/license-Unlicense-blue.svg?longCache=True)](https://unlicense.org/)

### Installation
```bash
$ pip install django-abstract-user
```

### How it works
+   `AbstractBaseUser` model without any fields
+   `get_session_auth_hash` with `get_salted_hmac_key_salt`, `get_salted_hmac_value`
```python
    def get_salted_hmac_key_salt(self):
        return self.password

    def get_salted_hmac_value(self):
        return self.get_username()
```

### Examples
`users/modes.py`
```python
from django.db import models
from django_abstract_user.models import AbstractBaseUser

class User(AbstractBaseUser):
    login = models.TextField(unique=True)
    token = models.TextField(unique=True)

    USERNAME_FIELD = 'login'

    class Meta:
        db_table = 'users_user'

    def get_salted_hmac_key_salt(self):
        return self.token
```

### Links
+   [django/contrib/auth/base_user.py](https://github.com/django/django/blob/main/django/contrib/auth/base_user.py)