kopia lustrzana https://github.com/djpeacher/django-projects
0dc360b009
I realized that this could apply to more use cases if it just offered a custom field. |
||
---|---|---|
.. | ||
README.md | ||
__init__.py | ||
apps.py | ||
models.py |
README.md
django-user-solo
Proof of concept AutoOneToOneField
that creates an singleton instance for each user.
Inspired by django-solo ❤️
from user_solo.models import AutoOneToOneField
class Preference(models.Model):
user = AutoOneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
flag = models.BooleanField(default=True)
# All users will have .preference
user = User.objects.get(...)
user.preference # get_or_create