core: add invite model for sign-up
This commit is contained in:
parent
a63f2be999
commit
4b25924274
|
@ -0,0 +1,30 @@
|
||||||
|
# Generated by Django 2.1.4 on 2018-12-10 12:13
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('passbook_core', '0002_auto_20181210_1011'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Invite',
|
||||||
|
fields=[
|
||||||
|
('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
||||||
|
('expires', models.DateTimeField(blank=True, default=None, null=True)),
|
||||||
|
('fixed_username', models.TextField(blank=True, default=None)),
|
||||||
|
('fixed_email', models.TextField(blank=True, default=None)),
|
||||||
|
('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Invite',
|
||||||
|
'verbose_name_plural': 'Invites',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -249,3 +249,19 @@ class DebugRule(Rule):
|
||||||
|
|
||||||
verbose_name = _('Debug Rule')
|
verbose_name = _('Debug Rule')
|
||||||
verbose_name_plural = _('Debug Rules')
|
verbose_name_plural = _('Debug Rules')
|
||||||
|
|
||||||
|
class Invite(UUIDModel):
|
||||||
|
"""Single-use invite link"""
|
||||||
|
|
||||||
|
created_by = models.ForeignKey('User', on_delete=models.CASCADE)
|
||||||
|
expires = models.DateTimeField(default=None, blank=True, null=True)
|
||||||
|
fixed_username = models.TextField(blank=True, default=None)
|
||||||
|
fixed_email = models.TextField(blank=True, default=None)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return "Invite %s created by %s" % (self.uuid, self.created_by)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
|
||||||
|
verbose_name = _('Invite')
|
||||||
|
verbose_name_plural = _('Invites')
|
||||||
|
|
Reference in New Issue