Connecting WL + publishing author.
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 29 Jun 2023 14:24:19 +0000 (16:24 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 29 Jun 2023 14:24:19 +0000 (16:24 +0200)
src/apiclient/views.py
src/catalogue/views.py
src/documents/templates/documents/my_page.html

index b2f3aac..e43ae0c 100644 (file)
@@ -61,7 +61,7 @@ def oauth_callback(request, beta=False):
     conn.token_secret = access_token['oauth_token_secret']
     conn.save()
 
-    return HttpResponseRedirect('/')
+    return HttpResponseRedirect(reverse('documents_user'))
 
 
 @login_required
index 635af5f..5ea1bbe 100644 (file)
@@ -221,6 +221,13 @@ def publish_author(request, pk):
     data = {
         "name_pl": author.name,
         "description_pl": author.generate_description(),
+        "genitive": author.genitive,
+        "gazeta_link": author.gazeta_link,
+        "culturepl_link": author.culturepl_link,
+        "wiki_link_pl": author.plwiki,
+        "photo": request.build_absolute_uri(author.photo.url),
+        "photo_source": author.photo_source,
+        "photo_attribution": author.photo_attribution,
     }
     apiclient.api_call(request.user, f"authors/{author.slug}/", data)
     return redirect(reverse('admin:catalogue_author_change', args=[author.pk]))
index 68c458e..0768ab9 100644 (file)
 {% endblock leftcolumn %}
 
 {% block rightcolumn %}
-  {% if wllogin %}
-    <div class="card">
-      <div class="card-header">
-        <h2>Konto WL</h2>
-      </div>
-      <div class="card-body">
+  <div class="card mb-4">
+    <div class="card-header">
+      <h2>Konto WL</h2>
+    </div>
+    <div class="card-body">
+      {% if wllogin %}
         <p>
           Podłączone konto na Wolnych Lekturach:
           <strong>{{ wllogin }}</strong>
             Odłącz
           </button>
         </form>
-      </div>
-
+      {% else %}
+        <form method="post" action="{% url 'apiclient_oauth' %}">
+          {% csrf_token %}
+          <button class="btn btn-primary">
+            Podłącz konto
+          </button>
+        </form>
+      {% endif %}
     </div>
-  {% endif %}
+  </div>
 
   <div class="card">
        <div class="card-header">