stages/invitation: fix optional field being required
This commit is contained in:
parent
3549a9ecdd
commit
6a5a243dac
|
@ -37,8 +37,9 @@
|
||||||
<table class="pf-c-table pf-m-compact pf-m-grid-xl" role="grid">
|
<table class="pf-c-table pf-m-compact pf-m-grid-xl" role="grid">
|
||||||
<thead>
|
<thead>
|
||||||
<tr role="row">
|
<tr role="row">
|
||||||
|
<th role="columnheader" scope="col">{% trans 'ID' %}</th>
|
||||||
|
<th role="columnheader" scope="col">{% trans 'Created by' %}</th>
|
||||||
<th role="columnheader" scope="col">{% trans 'Expiry' %}</th>
|
<th role="columnheader" scope="col">{% trans 'Expiry' %}</th>
|
||||||
<th role="columnheader" scope="col">{% trans 'Link' %}</th>
|
|
||||||
<th role="cell"></th>
|
<th role="cell"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -47,12 +48,17 @@
|
||||||
<tr role="row">
|
<tr role="row">
|
||||||
<td role="cell">
|
<td role="cell">
|
||||||
<span>
|
<span>
|
||||||
{{ invitation.expiry }}
|
{{ invitation.invite_uuid }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td role="cell">
|
<td role="cell">
|
||||||
<span>
|
<span>
|
||||||
{{ invitation.Link }}
|
{{ invitation.created_by }}
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td role="cell">
|
||||||
|
<span>
|
||||||
|
{{ invitation.expiry|default:"-" }}
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -25,8 +25,5 @@ class InvitationForm(forms.ModelForm):
|
||||||
|
|
||||||
model = Invitation
|
model = Invitation
|
||||||
fields = ["expires", "fixed_data"]
|
fields = ["expires", "fixed_data"]
|
||||||
labels = {
|
|
||||||
"fixed_data": _("Optional fixed data to enforce on user enrollment."),
|
|
||||||
}
|
|
||||||
widgets = {"fixed_data": CodeMirrorWidget()}
|
widgets = {"fixed_data": CodeMirrorWidget()}
|
||||||
field_classes = {"fixed_data": YAMLField}
|
field_classes = {"fixed_data": YAMLField}
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
# Generated by Django 3.1.4 on 2020-12-25 21:43
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("authentik_stages_invitation", "0001_initial"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="invitation",
|
||||||
|
name="fixed_data",
|
||||||
|
field=models.JSONField(blank=True, default=dict),
|
||||||
|
),
|
||||||
|
]
|
|
@ -61,7 +61,11 @@ class Invitation(models.Model):
|
||||||
|
|
||||||
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
created_by = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||||
expires = models.DateTimeField(default=None, blank=True, null=True)
|
expires = models.DateTimeField(default=None, blank=True, null=True)
|
||||||
fixed_data = models.JSONField(default=dict)
|
fixed_data = models.JSONField(
|
||||||
|
default=dict,
|
||||||
|
blank=True,
|
||||||
|
help_text=_("Optional fixed data to enforce on user enrollment."),
|
||||||
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"Invitation {self.invite_uuid.hex} created by {self.created_by}"
|
return f"Invitation {self.invite_uuid.hex} created by {self.created_by}"
|
||||||
|
|
Reference in New Issue