Specify the user model using the AUTH_USER_MODEL setting

Specify the user model using the AUTH_USER_MODEL setting as discussed in the Docs.
https://docs.djangoproject.com/en/dev/topics/auth/customizing/#referencing-the-user-model
pull/704/head
Gabriel Gadelha 2019-07-17 14:30:50 -03:00 zatwierdzone przez GitHub
rodzic d4be8357b7
commit db6d662dfa
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 2 dodań i 2 usunięć

Wyświetl plik

@ -1,13 +1,13 @@
import logging
from django.db import models
from django.contrib.postgres import fields
from django.contrib.auth.models import User
from django.conf import settings
logger = logging.getLogger('app.logger')
class PluginDatum(models.Model):
key = models.CharField(max_length=255, help_text="Setting key", db_index=True)
user = models.ForeignKey(User, null=True, default=None, on_delete=models.CASCADE, help_text="The user this setting belongs to. If NULL, the setting is global.")
user = models.ForeignKey(settings.AUTH_USER_MODEL, null=True, default=None, on_delete=models.CASCADE, help_text="The user this setting belongs to. If NULL, the setting is global.")
int_value = models.IntegerField(blank=True, null=True, default=None, help_text="Integer value")
float_value = models.FloatField(blank=True, null=True, default=None, help_text="Float value")
bool_value = models.NullBooleanField(blank=True, null=True, default=None, help_text="Bool value")