[tasks] Fix todoist login link on settings
This commit is contained in:
@ -3,6 +3,7 @@ from django.http.response import HttpResponseBadRequest
|
|||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.views.generic import FormView
|
from django.views.generic import FormView
|
||||||
from profiles.forms import UserProfileForm
|
from profiles.forms import UserProfileForm
|
||||||
|
from tasks.todoist import generate_todoist_oauth_url
|
||||||
|
|
||||||
|
|
||||||
class ProfileFormView(LoginRequiredMixin, FormView):
|
class ProfileFormView(LoginRequiredMixin, FormView):
|
||||||
@ -27,4 +28,5 @@ class ProfileFormView(LoginRequiredMixin, FormView):
|
|||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context["user_id"] = self.request.user.id
|
context["user_id"] = self.request.user.id
|
||||||
context["profile"] = self.request.user.profile
|
context["profile"] = self.request.user.profile
|
||||||
|
context["todoist_oauth_url"] = generate_todoist_oauth_url(self.request.user.id)
|
||||||
return context
|
return context
|
||||||
|
|||||||
@ -146,7 +146,7 @@
|
|||||||
<a href="{% url 'tasks:task_todoist_auth' %}" class="btn btn-sm btn-secondary">Reconnect to Todoist</a>
|
<a href="{% url 'tasks:task_todoist_auth' %}" class="btn btn-sm btn-secondary">Reconnect to Todoist</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>Not connected</p>
|
<p>Not connected</p>
|
||||||
<a href="{% url 'tasks:task_todoist_auth' %}" class="btn btn-sm btn-primary">Connect to Todoist</a>
|
<a href="{{todoist_oauth_url}}" class="btn btn-sm btn-primary">Connect to Todoist</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user