-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
175 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.forms import CharField, ModelForm | ||
from api.models import UserOutstandingToken | ||
|
||
|
||
class UserTokenForm(ModelForm): | ||
""" | ||
Form for token description editing | ||
""" | ||
|
||
class Meta: | ||
model = UserOutstandingToken | ||
fields = ( | ||
"description", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% extends BASE_TEMPLATE %}{% load i18n %} | ||
{% block content %} | ||
<h3>Delete token of "{{ username }}"</h3> | ||
<form action="" method="post">{% csrf_token %} | ||
<p class="alert alert-danger">{% trans "You asked to delete a token.<br />It will be permanently deleted and this action cannot be undone.<br />Please confirm." %}</p> | ||
<p><input type="submit" class="btn btn-danger" name="delete_confirm" value="{% trans "Ok" %}" /> <a class="btn btn-default" href="javascript:history.back()">{% trans "Cancel" %}</a></p> | ||
</form> | ||
|
||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% extends BASE_TEMPLATE %}{% load i18n %} | ||
{% load local_timezone %} | ||
{% block content %} | ||
<h2>{% trans "Edit token description " %} {{ token.jti }}</h2> | ||
|
||
{% if form.errors %} | ||
<div class="alert alert-error"> | ||
<button type="button" class="close" data-dismiss="alert">×</button> | ||
<p>{% trans "The form contains errors and cannot be submitted, please check the fields highlighted in red." %}</p> | ||
</div> | ||
{% endif %} | ||
{% if form.non_field_errors %} | ||
<div class="alert alert-error"> | ||
<button type="button" class="close" data-dismiss="alert">×</button> | ||
{% for error in form.non_field_errors %} | ||
<p>{{ error }}</p> | ||
{% endfor %} | ||
</div> | ||
{% endif %} | ||
<form action="" method="post" class="horizontal" enctype="multipart/form-data">{% csrf_token %} | ||
{% include "base/form_snippet.html" %} | ||
<div class="form-actions"> | ||
<button class="btn btn-primary" type="submit">{% trans "Save" %}</button> | ||
</div> | ||
</form> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,39 @@ | ||
from api.views import ResourceAPIDownload, ResourceAPIList | ||
from django.urls import path | ||
from django.urls import re_path as url | ||
from api.views import HubTokenDetailView, HubTokenListView, hub_token_create | ||
from api.views import UserTokenDetailView, UserTokenListView, user_token_create, user_token_update, user_token_delete | ||
urlpatterns = [ | ||
path("resources/", ResourceAPIList.as_view(), name="resource-list"), | ||
path( | ||
"resource/<uuid:uuid>/", ResourceAPIDownload.as_view(), name="resource-download" | ||
), | ||
url( | ||
r"^tokens/$", | ||
HubTokenListView.as_view(), | ||
name="hub_token_list", | ||
UserTokenListView.as_view(), | ||
name="user_token_list", | ||
), | ||
url( | ||
r"^tokens/(?P<pk>\d+)/$", | ||
HubTokenDetailView.as_view(), | ||
name="hub_token_detail", | ||
UserTokenDetailView.as_view(), | ||
name="user_token_detail", | ||
), | ||
url( | ||
r"^tokens/create/$", | ||
hub_token_create, | ||
user_token_create, | ||
{}, | ||
name="hub_token_create", | ||
name="user_token_create", | ||
), | ||
url( | ||
r"^tokens/(?P<token_id>\d+)/update$", | ||
user_token_update, | ||
{}, | ||
name="user_token_update", | ||
), | ||
url( | ||
r"^tokens/(?P<token_id>[^\/]+)/delete/$", | ||
user_token_delete, | ||
{}, | ||
name="user_token_delete", | ||
), | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.