Disable fetch button during timeout period
This commit is contained in:
parent
0f30b61445
commit
b2927151ef
2 changed files with 20 additions and 5 deletions
|
|
@ -4,19 +4,25 @@
|
||||||
{% block actions %}
|
{% block actions %}
|
||||||
<section class="section form__section--last">
|
<section class="section form__section--last">
|
||||||
<fieldset class="fieldset form__fieldset">
|
<fieldset class="fieldset form__fieldset">
|
||||||
|
{% include "components/form/confirm-button.html" %}
|
||||||
|
|
||||||
<a class="link button button--primary" href="{% url 'accounts:password-change' %}">
|
<a class="link button button--primary" href="{% url 'accounts:password-change' %}">
|
||||||
{% trans "Change password" %}
|
{% trans "Change password" %}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
{% if favicon_task_allowed %}
|
||||||
<a class="link button button--primary" href="{% url 'accounts:settings:favicon' %}">
|
<a class="link button button--primary" href="{% url 'accounts:settings:favicon' %}">
|
||||||
{% trans "Fetch favicons" %}
|
{% trans "Fetch favicons" %}
|
||||||
</a>
|
</a>
|
||||||
|
{% else %}
|
||||||
|
<button class="button button--primary button--disabled" disabled>
|
||||||
|
{% trans "Fetch favicons" %}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<a class="link button button--primary" href="{% url 'accounts:settings:integrations' %}">
|
<a class="link button button--primary" href="{% url 'accounts:settings:integrations' %}">
|
||||||
{% trans "Third party integrations" %}
|
{% trans "Third party integrations" %}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{% include "components/form/confirm-button.html" %}
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</section>
|
</section>
|
||||||
{% endblock actions %}
|
{% endblock actions %}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
from django.core.cache import cache
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.views.generic.edit import FormView, ModelFormMixin
|
from django.views.generic.edit import FormView, ModelFormMixin
|
||||||
|
|
||||||
|
|
@ -19,6 +20,14 @@ class SettingsView(ModelFormMixin, FormView):
|
||||||
self.object = self.get_object()
|
self.object = self.get_object()
|
||||||
return super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
|
||||||
|
return {
|
||||||
|
**context,
|
||||||
|
"favicon_task_allowed": not cache.get(f"{self.request.user}-favicon-task"),
|
||||||
|
}
|
||||||
|
|
||||||
def get_object(self, **kwargs):
|
def get_object(self, **kwargs):
|
||||||
return self.request.user
|
return self.request.user
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue