Add created date and sorting to invites

This commit is contained in:
Mouse Reeve 2021-01-05 11:08:24 -08:00
parent b861a3025b
commit 11212401a0
2 changed files with 3 additions and 1 deletions

View file

@ -50,6 +50,7 @@ def new_access_code():
class SiteInvite(models.Model):
''' gives someone access to create an account on the instance '''
created_date = models.DateTimeField(auto_now_add=True)
code = models.CharField(max_length=32, default=new_access_code)
expiry = models.DateTimeField(blank=True, null=True)
use_limit = models.IntegerField(blank=True, null=True)

View file

@ -399,7 +399,8 @@ def manage_invites(request):
''' invite management page '''
data = {
'title': 'Invitations',
'invites': models.SiteInvite.objects.filter(user=request.user),
'invites': models.SiteInvite.objects.filter(
user=request.user).order_by('-created_date'),
'form': forms.CreateInviteForm(),
}
return TemplateResponse(request, 'manage_invites.html', data)