cleanup
This commit is contained in:
parent
307ac359a2
commit
b852161ed6
6 changed files with 37 additions and 17 deletions
|
|
@ -55,21 +55,25 @@ class ApplicationForm(forms.ModelForm):
|
||||||
class ApplicationCreateForm(forms.ModelForm):
|
class ApplicationCreateForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Application
|
model = Application
|
||||||
fields = ['name',
|
fields = [
|
||||||
'client_id',
|
'name',
|
||||||
'client_secret',
|
# 'client_id',
|
||||||
|
# 'client_secret',
|
||||||
# 'available_scopes_list',
|
# 'available_scopes_list',
|
||||||
# 'authorization_grant_type',
|
# 'authorization_grant_type',
|
||||||
'redirect_uris',
|
'redirect_uris',
|
||||||
'post_logout_redirect_uris']
|
# 'post_logout_redirect_uris'
|
||||||
|
]
|
||||||
readonly_fields = ['client_id', 'client_secret']
|
|
||||||
|
|
||||||
|
|
||||||
class ApplicationUpdateForm(forms.ModelForm):
|
class ApplicationUpdateForm(forms.ModelForm):
|
||||||
|
name = forms.CharField(disabled=True)
|
||||||
|
client_id = forms.CharField(disabled=True)
|
||||||
|
client_secret = forms.CharField(disabled=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Application
|
model = Application
|
||||||
fields = [
|
fields = [
|
||||||
|
'name',
|
||||||
'client_id',
|
'client_id',
|
||||||
'client_secret',
|
'client_secret',
|
||||||
# 'authorization_grant_type',
|
# 'authorization_grant_type',
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,9 @@ class ApplicationCreateView(CreateView):
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
form.instance.user = self.request.user
|
form.instance.user = self.request.user
|
||||||
form.instance.client_type = Application.CLIENT_PUBLIC
|
form.instance.client_type = Application.CLIENT_PUBLIC
|
||||||
|
form.instance.algorithm = Application.RS256_ALGORITHM
|
||||||
|
form.instance.hash_client_secret = False
|
||||||
|
form.instance.authorization_grant_type = Application.GRANT_AUTHORIZATION_CODE
|
||||||
return super().form_valid(form)
|
return super().form_valid(form)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
{% load jalali_tags %}
|
{% load jalali_tags %}
|
||||||
|
|
||||||
{% block title %}Application: create{% endblock %}
|
{% block title %}Application Register{% endblock %}
|
||||||
{% block page_title %}Application: create{% endblock %}
|
{% block page_title %}Application Register{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form action="{{ request.get_full_path }}" method="post" enctype="multipart/form-data" novalidate>
|
<form action="{{ request.get_full_path }}" method="post" enctype="multipart/form-data" novalidate>
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
|
<a href="{% url 'gooyal_oauth2:application_list' %}" class="btn btn-danger ms-2">انصراف</a>
|
||||||
<input class="btn btn-success ms-2" type="submit" value="ثبت" name="save"/>
|
<input class="btn btn-success ms-2" type="submit" value="ثبت" name="save"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,19 @@
|
||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
{% load jalali_tags %}
|
{% load jalali_tags %}
|
||||||
|
|
||||||
{% block title %}Application: detail{% endblock %}
|
{% block title %}Application Detail: {{ object }}{% endblock %}
|
||||||
{% block page_title %}Application: detail{% endblock %}
|
{% block page_title %}Application Detail: {{ object }}{% endblock %}
|
||||||
|
|
||||||
|
{% block page_action %}
|
||||||
|
<div class="me-2">
|
||||||
|
<a href="{% url 'gooyal_oauth2:application_update' object.pk %}">
|
||||||
|
<div class="btn btn-success">
|
||||||
|
<span class="bi bi-gear-fill"></span>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>application: {{ object.name }}!</p>
|
<p>application: {{ object.name }}!</p>
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
{% load tags %}
|
{% load tags %}
|
||||||
|
|
||||||
|
|
||||||
{% block title %}Application: list{% endblock %}
|
{% block title %}Application List{% endblock %}
|
||||||
{% block page_title %}Application: list{% endblock %}
|
{% block page_title %}Application List{% endblock %}
|
||||||
{% block page_action %}
|
{% block page_action %}
|
||||||
{% include "include/filter_action.html" %}
|
{% include "include/filter_action.html" %}
|
||||||
<div class="me-2">
|
<div class="me-2">
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,8 @@
|
||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
{% load jalali_tags %}
|
{% load jalali_tags %}
|
||||||
|
|
||||||
{% block title %}Application: update{% endblock %}
|
{% block title %}Application Update: {{ object }}{% endblock %}
|
||||||
{% block page_title %}Application: update{% endblock %}
|
{% block page_title %}Application Update: {{ object }}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form action="{{ request.get_full_path }}" method="post" enctype="multipart/form-data" novalidate>
|
<form action="{{ request.get_full_path }}" method="post" enctype="multipart/form-data" novalidate>
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
<div class="d-flex justify-content-end">
|
<div class="d-flex justify-content-end">
|
||||||
|
<a href="{% url "gooyal_oauth2:application_detail" object.pk %}" class="btn btn-danger ms-2">انصراف</a>
|
||||||
<input class="btn btn-success ms-2" type="submit" value="ثبت" name="save"/>
|
<input class="btn btn-success ms-2" type="submit" value="ثبت" name="save"/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue