diff --git a/docs/upgrading/to-0.12.md b/docs/upgrading/to-0.12.md index 8c2407de8..55830cd99 100644 --- a/docs/upgrading/to-0.12.md +++ b/docs/upgrading/to-0.12.md @@ -7,6 +7,7 @@ This update brings these headline features: - Add System Task Overview to see all background tasks, their status, the log output, and retry them - Alerts now disappear automatically - Audit Logs are now searchable +- Users can now create their own Tokens to access the API Fixes: diff --git a/passbook/core/forms/token.py b/passbook/core/forms/token.py new file mode 100644 index 000000000..bbc316b83 --- /dev/null +++ b/passbook/core/forms/token.py @@ -0,0 +1,22 @@ +"""Core user token form""" +from django import forms + +from passbook.core.models import Token + + +class UserTokenForm(forms.ModelForm): + """Token form, for tokens created by endusers""" + + class Meta: + + model = Token + fields = [ + "identifier", + "expires", + "expiring", + "description", + ] + widgets = { + "identifier": forms.TextInput(), + "description": forms.TextInput(), + } diff --git a/passbook/core/templates/user/base.html b/passbook/core/templates/user/base.html index b87c6e423..669102553 100644 --- a/passbook/core/templates/user/base.html +++ b/passbook/core/templates/user/base.html @@ -16,6 +16,10 @@ {% trans 'User Details' %} +
{% trans "Tokens can be used to access passbook's API." %} +
+{% trans 'Identifier' %} | +{% trans 'Expires?' %} | +{% trans 'Expiry Date' %} | +{% trans 'Description' %} | ++ |
---|---|---|---|---|
+ {{ token.identifier }}
+ |
+ + + {{ token.expiring|yesno:"Yes,No" }} + + | ++ + {% if not token.expiring %} + - + {% else %} + {{ token.expires }} + {% endif %} + + | ++ + {{ token.description }} + + | ++ {% trans 'Edit' %} + {% trans 'Delete' %} + | +