fix admin site add new mastodon issue
This commit is contained in:
parent
3b067049c4
commit
18465825a8
2 changed files with 8 additions and 2 deletions
|
@ -23,7 +23,7 @@ class MastodonApplicationModelAdmin(admin.ModelAdmin):
|
|||
(not bool(request.POST.get('is_proxy')) and bool(request.POST.get('proxy_to'))):
|
||||
request.POST['domain_name'] = _("请同时填写is_proxy和proxy_to。")
|
||||
else:
|
||||
if request.POST['is_proxy']:
|
||||
if request.POST.get("is_proxy"):
|
||||
try:
|
||||
origin = MastodonApplication.objects.get(domain_name=request.POST['proxy_to'])
|
||||
# set proxy credentials to those of its original site
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
{% if user.is_authenticated %}
|
||||
<a href="{% url 'common:home' %}" class="button">{% trans '前往我的主页' %}</a>
|
||||
{% else %}
|
||||
<select name="sites" id="sitesSelect">
|
||||
<select name="sites" id="sitesSelect" placeholder="test">
|
||||
{% for site in sites %}
|
||||
<option value="{{ site.domain_name }}" data-client-id="{{ site.client_id }}">@{{ site.domain_name }}</option>
|
||||
{% endfor %}
|
||||
|
@ -49,9 +49,15 @@
|
|||
|
||||
</div>
|
||||
{% if not user.is_authenticated %}
|
||||
|
||||
|
||||
<script>
|
||||
// $("#sitesSelect").chosen();
|
||||
{% if selected_site %}
|
||||
$("#sitesSelect").val("{{ selected_site }}");
|
||||
{% else %}
|
||||
$("#sitesSelect").val($("#sitesSelect option:first").val());
|
||||
{% endif %}
|
||||
$("button[name=login]").click(function(e) {
|
||||
e.preventDefault();
|
||||
let selected = $("#sitesSelect").find(":selected");
|
||||
|
|
Loading…
Add table
Reference in a new issue