コード例 #1
0
class Migration(migrations.Migration):

    dependencies = [
        ('email_auth', '0003_django110'),
    ]

    operations = []

    if VERSION >= (1, 10):
        from django.contrib.auth import validators
        from django.utils import six

        operations.append(
            migrations.AlterField(
                model_name='user',
                name='username',
                field=models.CharField(
                    error_messages={
                        'unique': 'A user with that username already exists.'
                    },
                    help_text=
                    'Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                    max_length=150,
                    unique=True,
                    validators=[
                        validators.UnicodeUsernameValidator()
                        if six.PY3 else validators.ASCIIUsernameValidator()
                    ],
                    verbose_name='username'),
            ))
コード例 #2
0
class Migration(migrations.Migration):

    dependencies = [
        ('auth', '0003_alter_user_email_max_length'),
    ]

    # No database changes; modifies validators and error_messages (#13147).
    operations = [
        migrations.AlterField(
            model_name='user',
            name='username',
            field=models.CharField(
                error_messages={
                    'unique': 'A user with that username already exists.'
                },
                max_length=30,
                validators=[
                    validators.UnicodeUsernameValidator()
                    if six.PY3 else validators.ASCIIUsernameValidator()
                ],
                help_text=
                'Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.',
                unique=True,
                verbose_name='username'),
        ),
    ]
コード例 #3
0
class Migration(migrations.Migration):

    dependencies = [("users", "0004_auto_20180325_2244")]

    operations = [
        migrations.AlterField(
            model_name="user",
            name="last_name",
            field=models.CharField(blank=True,
                                   max_length=30,
                                   verbose_name="last name"),
        ),
        migrations.AlterField(
            model_name="user",
            name="username",
            field=models.CharField(
                error_messages={
                    "unique": "A user with that username already exists."
                },
                help_text=
                "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
                max_length=150,
                unique=True,
                validators=[validators.UnicodeUsernameValidator()],
                verbose_name="username",
            ),
        ),
    ]
コード例 #4
0
ファイル: models.py プロジェクト: jgsilva667/EveryTrailStore
class CustomUser(AbstractUser):
    username = models.CharField(
        error_messages={'unique': 'A user with that username already exists.'},
        help_text=
        'Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
        max_length=150,
        unique=True,
        validators=[validators.UnicodeUsernameValidator()],
        verbose_name='username')
    first_name = models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='first name')
    last_name = models.CharField(blank=True,
                                 max_length=150,
                                 verbose_name='last name')
    email = models.EmailField(blank=True,
                              max_length=254,
                              verbose_name='email address')
    password = models.CharField(max_length=128, verbose_name='password')
    address = models.CharField(max_length=200)
    city = models.CharField(max_length=50)
    state = models.CharField(max_length=50)
    zipcode = models.CharField(max_length=10)
    phone_number = models.CharField(max_length=50)
    updated_date = models.DateTimeField(auto_now_add=True)

    def updated(self):
        self.updated_date = timezone.now()
        self.save()

    def __str__(self):
        return str(self.cust_name)
コード例 #5
0
class Migration(migrations.Migration):

    dependencies = [
        ("auth", "0003_alter_user_email_max_length"),
    ]

    # No database changes; modifies validators and error_messages (#13147).
    operations = [
        migrations.AlterField(
            model_name="user",
            name="username",
            field=models.CharField(
                error_messages={
                    "unique": "A user with that username already exists."
                },
                max_length=30,
                validators=[validators.UnicodeUsernameValidator()],
                help_text=
                ("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ "
                 "only."),
                unique=True,
                verbose_name="username",
            ),
        ),
    ]
コード例 #6
0
class Migration(migrations.Migration):

    dependencies = [
        ('auth', '0006_require_contenttypes_0002'),
    ]

    operations = [
        migrations.AlterField(
            model_name='user',
            name='username',
            field=models.CharField(
                error_messages={
                    'unique': 'A user with that username already exists.'
                },
                help_text=
                'Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.',
                max_length=30,
                unique=True,
                validators=[
                    validators.UnicodeUsernameValidator()
                    if six.PY3 else validators.ASCIIUsernameValidator()
                ],
                verbose_name='username',
            ),
        ),
    ]
コード例 #7
0
class User(auth_models.AbstractUser):
    username = models.CharField(
        'username',
        max_length=150,
        unique=True,
        validators=[validators.UnicodeUsernameValidator()],
        error_messages={'unique': 'A user with that username already exists.'},
    )
コード例 #8
0
 def test_unicode_validator(self):
     valid_usernames = ['joe', 'René', 'ᴮᴵᴳᴮᴵᴿᴰ', 'أحمد']
     invalid_usernames = [
         "o'connell", "عبد ال",
         "zerowidth\u200Bspace", "nonbreaking\u00A0space",
         "en\u2013dash",
     ]
     v = validators.UnicodeUsernameValidator()
     for valid in valid_usernames:
         v(valid)
     for invalid in invalid_usernames:
         with self.assertRaises(ValidationError):
             v(invalid)
コード例 #9
0
class User(AbstractBaseUser, PermissionsMixin):
    """カスタムユーザーモデル."""
    username_validator = validators.UnicodeUsernameValidator()
    username = models.CharField(
        _('username'),
        max_length=150,
        unique=True,
        help_text=
        _('Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.'
          ),
        validators=[username_validator],
        error_messages={
            'unique': _("A user with that username already exists."),
        },
    )
    email = models.EmailField(_('email address'), unique=True)

    is_staff = models.BooleanField(
        _('staff status'),
        default=False,
        help_text=_(
            'Designates whether the user can log into this admin site.'),
    )

    is_active = models.BooleanField(
        _('active'),
        default=True,
        help_text=_(
            'Designates whether this user should be treated as active. '
            'Unselect this instead of deleting accounts.'),
    )

    date_joined = models.DateTimeField(_('date joined'), default=timezone.now)

    image = models.ImageField(_('image'), upload_to='img/user/icon/')
    status = models.TextField(_('status'))

    objects = UserManager()

    EMAIL_FIELD = 'email'
    USERNAME_FIELD = 'email'
    REQUIRED_FIELDS = []

    class Meta:
        verbose_name = _('user')
        verbose_name_plural = _('users')

    def email_user(self, subject, message, from_email=None, **kwargs):
        """Send an email to this user."""
        send_mail(subject, message, from_email, [self.email], **kwargs)
コード例 #10
0
 def test_unicode_validator(self):
     valid_usernames = ["joe", "René", "ᴮᴵᴳᴮᴵᴿᴰ", "أحمد"]
     invalid_usernames = [
         "o'connell",
         "عبد ال",
         "zerowidth\u200Bspace",
         "nonbreaking\u00A0space",
         "en\u2013dash",
         "trailingnewline\u000A",
     ]
     v = validators.UnicodeUsernameValidator()
     for valid in valid_usernames:
         with self.subTest(valid=valid):
             v(valid)
     for invalid in invalid_usernames:
         with self.subTest(invalid=invalid):
             with self.assertRaises(ValidationError):
                 v(invalid)
コード例 #11
0
class Migration(migrations.Migration):

    dependencies = [
        ('auth', '0007_alter_validators_add_error_messages'),
    ]

    operations = [
        migrations.AlterField(
            model_name='user',
            name='username',
            field=models.CharField(
                error_messages={'unique': 'A user with that username already exists.'},
                help_text='Required. 150 characters or fewer. Letssters, digits weweand @/./+/-/_ only.',
                max_length=150,
                unique=True,
                validators=[validators.UnicodeUsernameValidator()],
                verbose_name='username',
            ),
        ),
    ]
コード例 #12
0
class Migration(migrations.Migration):

    dependencies = [("auth", "0006_require_contenttypes_0002")]

    operations = [
        migrations.AlterField(
            model_name="user",
            name="username",
            field=models.CharField(
                error_messages={
                    "unique": "A user with that username already exists."
                },
                help_text=
                "Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.",
                max_length=30,
                unique=True,
                validators=[validators.UnicodeUsernameValidator()],
                verbose_name="username",
            ),
        )
    ]
コード例 #13
0
class Migration(migrations.Migration):

    dependencies = [
        ("auth", "0007_alter_validators_add_error_messages"),
    ]

    operations = [
        migrations.AlterField(
            model_name="user",
            name="username",
            field=models.CharField(
                error_messages={
                    "unique": "A user with that username already exists."
                },
                help_text=
                ("Required. 150 characters or fewer. Letters, digits and @/./+/-/_ "
                 "only."),
                max_length=150,
                unique=True,
                validators=[validators.UnicodeUsernameValidator()],
                verbose_name="username",
            ),
        ),
    ]
コード例 #14
0
class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '__first__'),
    ]

    operations = [
        migrations.CreateModel(
            name='Permission',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(max_length=50, verbose_name='name')),
                ('content_type', models.ForeignKey(
                    to='contenttypes.ContentType',
                    on_delete=models.CASCADE,
                    to_field='id',
                    verbose_name='sections type',
                )),
                ('codename', models.CharField(max_length=100, verbose_name='codename')),
            ],
            options={
                'ordering': ('content_type__app_label', 'content_type__model', 'codename'),
                'unique_together': {('content_type', 'codename')},
                'verbose_name': 'permission',
                'verbose_name_plural': 'permissions',
            },
            managers=[
                ('objects', django.contrib.auth.models.PermissionManager()),
            ],
        ),
        migrations.CreateModel(
            name='Group',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('name', models.CharField(unique=True, max_length=80, verbose_name='name')),
                ('permissions', models.ManyToManyField(to='auth.Permission', verbose_name='permissions', blank=True)),
            ],
            options={
                'verbose_name': 'group',
                'verbose_name_plural': 'groups',
            },
            managers=[
                ('objects', django.contrib.auth.models.GroupManager()),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(default=timezone.now, verbose_name='last login')),
                ('is_superuser', models.BooleanField(
                    default=False,
                    help_text='Designates that this user has all permissions without explicitly assigning them.',
                    verbose_name='superuser status'
                )),
                ('username', models.CharField(
                    help_text='Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.', unique=True,
                    max_length=30, verbose_name='username',
                    validators=[validators.UnicodeUsernameValidator()],
                )),
                ('first_name', models.CharField(max_length=30, verbose_name='first name', blank=True)),
                ('last_name', models.CharField(max_length=30, verbose_name='last name', blank=True)),
                ('email', models.EmailField(max_length=75, verbose_name='email address', blank=True)),
                ('is_staff', models.BooleanField(
                    default=False, help_text='Designates whether the user can log into this admin site.',
                    verbose_name='staff status'
                )),
                ('is_active', models.BooleanField(
                    default=True, verbose_name='active', help_text=(
                        'Designates whether this user should be treated as active. Unselect this instead of deleting '
                        'accounts.'
                    )
                )),
                ('date_joined', models.DateTimeField(default=timezone.now, verbose_name='date joined')),
                ('groups', models.ManyToManyField(
                    to='auth.Group', verbose_name='groups', blank=True, related_name='user_set',
                    related_query_name='user', help_text=(
                        'The groups this user belongs to. A user will get all permissions granted to each of their '
                        'groups.'
                    )
                )),
                ('user_permissions', models.ManyToManyField(
                    to='auth.Permission', verbose_name='user permissions', blank=True,
                    help_text='Specific permissions for this user.', related_name='user_set',
                    related_query_name='user')
                 ),
            ],
            options={
                'swappable': 'AUTH_USER_MODEL',
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
    ]
コード例 #15
0
ファイル: forms.py プロジェクト: Alex1um/CAmS
class RegisterForm(forms.Form):
    register_username = forms.CharField(
        max_length=32,
        min_length=3,
        required=True,
        strip=False,
        validators=[validators.ASCIIUsernameValidator()],
        widget=forms.TextInput({
            "placeholder": "Username",
            "aria-label": "Username",
            "class": "form-control"
        }),
        label="Username")

    register_first_name = forms.CharField(
        max_length=32,
        min_length=3,
        strip=False,
        validators=[validators.UnicodeUsernameValidator()],
        widget=forms.TextInput({
            "placeholder": "Name",
            "aria-label": "Name",
            "class": "form-control"
        }),
        label="Name",
        required=False,
    )
    register_last_name = forms.CharField(
        max_length=32,
        min_length=3,
        strip=False,
        validators=[validators.UnicodeUsernameValidator()],
        label="Last Name",
        widget=forms.TextInput({
            "placeholder": "LastName",
            "aria-label": "LastName",
            "class": "form-control"
        }),
        required=False,
    )
    register_email = forms.EmailField(
        required=True,
        validators=[validators.validators.validate_email],
        label="Email",
        widget=forms.EmailInput({
            "placeholder": "Email",
            "aria-label": "Email",
            "class": "form-control"
        }),
    )
    register_password = forms.CharField(
        strip=False,
        required=True,
        validators=map(make_validator_callable,
                       get_default_password_validators()),
        label="Password",
        widget=forms.PasswordInput({
            "placeholder": "Password",
            "aria-label": "Password",
            "class": "form-control"
        }),
    )
    register_repeat_password = forms.CharField(
        strip=False,
        required=True,
        label="Repeat Password",
        widget=forms.PasswordInput(
            {
                "placeholder": "Repeat Password",
                "aria-label": "Repeat Password",
                "class": "form-control"
            }, ),
    )

    def clean(self):
        tmp = super().clean()
        try:
            pass1 = tmp.get("register_password")
            pass2 = tmp.get("register_repeat_password")
            if pass1 != pass2:
                self.add_error("register_repeat_password",
                               "Passwords does not match")
        except TypeError:
            pass
        try:
            if User.objects.get(username=tmp.get("register_username")):
                self.add_error("register_username", "User already exists")
        except User.DoesNotExist:
            pass
        return tmp
コード例 #16
0
class Migration(migrations.Migration):

    dependencies = [
        ("contenttypes", "__first__"),
    ]

    operations = [
        migrations.CreateModel(
            name="Permission",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("name", models.CharField(max_length=50, verbose_name="name")),
                (
                    "content_type",
                    models.ForeignKey(
                        to="contenttypes.ContentType",
                        on_delete=models.CASCADE,
                        to_field="id",
                        verbose_name="content type",
                    ),
                ),
                ("codename",
                 models.CharField(max_length=100, verbose_name="codename")),
            ],
            options={
                "ordering": (
                    "content_type__app_label",
                    "content_type__model",
                    "codename",
                ),
                "unique_together": {("content_type", "codename")},
                "verbose_name":
                "permission",
                "verbose_name_plural":
                "permissions",
            },
            managers=[
                ("objects", django.contrib.auth.models.PermissionManager()),
            ],
        ),
        migrations.CreateModel(
            name="Group",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                (
                    "name",
                    models.CharField(unique=True,
                                     max_length=80,
                                     verbose_name="name"),
                ),
                (
                    "permissions",
                    models.ManyToManyField(to="auth.Permission",
                                           verbose_name="permissions",
                                           blank=True),
                ),
            ],
            options={
                "verbose_name": "group",
                "verbose_name_plural": "groups",
            },
            managers=[
                ("objects", django.contrib.auth.models.GroupManager()),
            ],
        ),
        migrations.CreateModel(
            name="User",
            fields=[
                (
                    "id",
                    models.AutoField(
                        verbose_name="ID",
                        serialize=False,
                        auto_created=True,
                        primary_key=True,
                    ),
                ),
                ("password",
                 models.CharField(max_length=128, verbose_name="password")),
                (
                    "last_login",
                    models.DateTimeField(default=timezone.now,
                                         verbose_name="last login"),
                ),
                (
                    "is_superuser",
                    models.BooleanField(
                        default=False,
                        help_text=
                        "Designates that this user has all permissions without explicitly assigning them.",
                        verbose_name="superuser status",
                    ),
                ),
                (
                    "username",
                    models.CharField(
                        help_text=
                        "Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.",
                        unique=True,
                        max_length=30,
                        verbose_name="username",
                        validators=[validators.UnicodeUsernameValidator()],
                    ),
                ),
                (
                    "first_name",
                    models.CharField(max_length=30,
                                     verbose_name="first name",
                                     blank=True),
                ),
                (
                    "last_name",
                    models.CharField(max_length=30,
                                     verbose_name="last name",
                                     blank=True),
                ),
                (
                    "email",
                    models.EmailField(max_length=75,
                                      verbose_name="email address",
                                      blank=True),
                ),
                (
                    "is_staff",
                    models.BooleanField(
                        default=False,
                        help_text=
                        "Designates whether the user can log into this admin site.",
                        verbose_name="staff status",
                    ),
                ),
                (
                    "is_active",
                    models.BooleanField(
                        default=True,
                        verbose_name="active",
                        help_text=
                        ("Designates whether this user should be treated as active. Unselect this instead of deleting "
                         "accounts."),
                    ),
                ),
                (
                    "date_joined",
                    models.DateTimeField(default=timezone.now,
                                         verbose_name="date joined"),
                ),
                (
                    "groups",
                    models.ManyToManyField(
                        to="auth.Group",
                        verbose_name="groups",
                        blank=True,
                        related_name="user_set",
                        related_query_name="user",
                        help_text=
                        ("The groups this user belongs to. A user will get all permissions granted to each of their "
                         "groups."),
                    ),
                ),
                (
                    "user_permissions",
                    models.ManyToManyField(
                        to="auth.Permission",
                        verbose_name="user permissions",
                        blank=True,
                        help_text="Specific permissions for this user.",
                        related_name="user_set",
                        related_query_name="user",
                    ),
                ),
            ],
            options={
                "swappable": "AUTH_USER_MODEL",
                "verbose_name": "user",
                "verbose_name_plural": "users",
            },
            managers=[
                ("objects", django.contrib.auth.models.UserManager()),
            ],
        ),
    ]
コード例 #17
0
def register_view(request):
    if request.user.is_authenticated:
        messages.info(request, "You have been logged out.")
        logout(request)

    reglink_id = request.GET.get("reglink_id",
                                 request.POST.get("reglink_id", ""))
    try:
        reglink = RegLink.objects.get(reglink_id=reglink_id)
        reglink_usable = reglink.is_usable()
    except RegLink.DoesNotExist:
        reglink_usable = False
        reglink = None
    context = {
        "can_register": True,
        "done_registration": False,
        "warning": "",
        "reglink_id": reglink_id,
        "email": getattr(reglink, "email", "EMPTY"),
    }
    if reglink_usable is False or request.method == "GET":
        user = User.objects.filter(email=context["email"]).first()
        if user:
            reglink.create_user(username=user.username)
            reglink.is_used = True
            reglink.save()
            messages.success(
                request,
                f"A user with {user.email} already exists in our database. "
                f"A new profile has been created. Please login with your "
                f"existing credentials.",
            )
            return shortcuts.redirect("/")
        if reglink_usable is False:
            context["can_register"] = False
            context[
                "warning"] = "Your registration link is invalid! Please check again!"
        return shortcuts.render(request, "registration/register.html", context)
    if request.method == "POST":
        username = request.POST.get("username", "")
        password = request.POST.get("password", "")
        password2 = request.POST.get("password2", "")
        github_handle = request.POST.get("github_handle", "")
        email_opt_in = request.POST.get("email_opt_in")
        reminder_disabled = False if email_opt_in == "on" else True
        info_valid = True
        registration_success = True
        if password != password2:
            context["warning"] += "Your password didn't match! <BR>"
            info_valid = False
        try:
            User.objects.get(username=username)
            info_valid = False
            context["warning"] += "Your username has been used!<br>"
        except User.DoesNotExist:
            pass

        # Check password
        try:
            password_validation.validate_password(password)
        except ValidationError as e:
            context["warning"] += f'{"<br>".join(e.messages)}<BR>'
            info_valid = False
        try:
            validators.UnicodeUsernameValidator()(username)
        except ValidationError as e:
            context["warning"] += f'{"<br>".join(e.messages)}<BR>'
            info_valid = False

        if info_valid:
            user = reglink.create_user(
                username=username,
                reminder_disabled=reminder_disabled,
                github_handle=github_handle,
            )
            user.set_password(password)
            user.save()
        else:
            user = None

        if user is None:
            registration_success = False
        if registration_success:
            reglink.is_used = True
            reglink.save()
            context["done_registration"] = True
            context["warning"] = ""
        else:
            context["done_registration"] = False

        return shortcuts.render(request, "registration/register.html", context)
コード例 #18
0
ファイル: views.py プロジェクト: juliocesark/python-blogs
def register_view(request):
    reglink_id = request.GET.get('reglink_id',
                                 request.POST.get('reglink_id', ''))
    try:
        reglink = RegLink.objects.get(reglink_id=reglink_id)
        reglink_usable = reglink.is_usable()
    except RegLink.DoesNotExist:
        reglink_usable = False
        reglink = None
    context = {
        'can_register': True,
        'done_registration': False,
        'warning': '',
        'reglink_id': reglink_id,
        'email': getattr(reglink, 'email', 'EMPTY')
    }
    if reglink_usable is False or request.method == 'GET':
        if reglink_usable is False:
            context['can_register'] = False
            context[
                'warning'] = 'Your registration link is invalid! Please check again!'
        return shortcuts.render(request, 'registration/register.html', context)
    if request.method == 'POST':
        username = request.POST.get('username', '')
        password = request.POST.get('password', '')
        password2 = request.POST.get('password2', '')
        info_valid = True
        registration_success = True
        if password != password2:
            context['warning'] += 'Your password didn\'t match! <BR>'
            info_valid = False
        try:
            User.objects.get(username=username)
            info_valid = False
            context['warning'] += 'Your username has been used!<br>'
        except User.DoesNotExist:
            pass

        # Check password
        try:
            password_validation.validate_password(password)
        except ValidationError as e:
            context['warning'] += f'{"<br>".join(e.messages)}<BR>'
            info_valid = False
        try:
            validators.UnicodeUsernameValidator()(username)
        except ValidationError as e:
            context['warning'] += f'{"<br>".join(e.messages)}<BR>'
            info_valid = False

        if info_valid:
            user = reglink.create_user(username=username)
            user.set_password(password)
            user.save()
        else:
            user = None

        if user is None:
            registration_success = False
        if registration_success:
            reglink.is_used = True
            reglink.save()
            context['done_registration'] = True
            context['warning'] = ''
        else:
            context['done_registration'] = False

        return shortcuts.render(request, 'registration/register.html', context)
コード例 #19
0
class Migration(migrations.Migration):
    initial = True

    dependencies = [("auth", "0011_update_proxy_permissions")]

    operations = [
        migrations.CreateModel(
            name="User",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("password",
                 models.CharField(max_length=128, verbose_name="password")),
                (
                    "last_login",
                    models.DateTimeField(blank=True,
                                         null=True,
                                         verbose_name="last login"),
                ),
                (
                    "is_superuser",
                    models.BooleanField(
                        default=False,
                        help_text="Designates that this user has all "
                        "permissions without explicitly assigning "
                        "them.",
                        verbose_name="superuser status",
                    ),
                ),
                (
                    "username",
                    models.CharField(
                        max_length=150,
                        unique=True,
                        verbose_name="username",
                        error_messages={
                            "unique":
                            "A user with that username "
                            "already exists."
                        },
                        help_text="Required. 150 characters or fewer. "
                        "Letters, digits and @/./+/-/_ only.",
                        validators=[
                            auth_validators.UnicodeUsernameValidator()
                        ],
                    ),
                ),
                (
                    "first_name",
                    models.CharField(blank=True,
                                     max_length=30,
                                     verbose_name="first name"),
                ),
                (
                    "last_name",
                    models.CharField(blank=True,
                                     max_length=150,
                                     verbose_name="last name"),
                ),
                (
                    "email",
                    models.EmailField(blank=True,
                                      max_length=254,
                                      verbose_name="email address"),
                ),
                (
                    "is_staff",
                    models.BooleanField(
                        default=False,
                        help_text="Designates whether the user can log into "
                        "this admin site.",
                        verbose_name="staff status",
                    ),
                ),
                (
                    "is_active",
                    models.BooleanField(
                        default=True,
                        help_text="Designates whether this user should be "
                        "treated as active. Unselect this instead "
                        "of deleting accounts.",
                        verbose_name="active",
                    ),
                ),
                (
                    "date_joined",
                    models.DateTimeField(default=timezone.now,
                                         verbose_name="date joined"),
                ),
                (
                    "groups",
                    models.ManyToManyField(
                        blank=True,
                        help_text="The groups this user belongs to. "
                        "A user will get all permissions granted t"
                        "o each of their groups.",
                        related_name="user_set",
                        related_query_name="user",
                        to="auth.Group",
                        verbose_name="groups",
                    ),
                ),
                (
                    "user_permissions",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Specific permissions for this user.",
                        related_name="user_set",
                        related_query_name="user",
                        to="auth.Permission",
                        verbose_name="user permissions",
                    ),
                ),
            ],
            options={
                "verbose_name": "user",
                "verbose_name_plural": "users",
                "abstract": False,
            },
            managers=[("objects", auth_models.UserManager())],
        ),
        migrations.CreateModel(
            name='Tenant',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('name', models.CharField(max_length=150, unique=True)),
                ('users',
                 models.ManyToManyField(related_name='tenants',
                                        to='galaxy_auth.User')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]