From 2d1c912be2b7866490c469889e18d2b5b343525a Mon Sep 17 00:00:00 2001 From: Trent Palmer Date: Fri, 3 Dec 2021 00:49:05 -0800 Subject: [PATCH] add about/apps --- about/__init__.py | 0 about/admin.py | 3 +++ about/apps.py | 6 ++++++ about/migrations/__init__.py | 0 about/models.py | 3 +++ about/templates/about/apps.html | 27 +++++++++++++++++++++++++++ about/tests.py | 3 +++ about/urls.py | 8 ++++++++ about/views.py | 5 +++++ audio/apps.py | 1 + audio/templates/audio/feeds.html | 3 ++- audio/templates/audio/index.html | 3 ++- audio/views.py | 8 +++++--- tp/settings.py | 1 + tp/templates/base.html | 3 +++ tp/templates/base_heading.html | 11 ++--------- tp/templates/base_navbar.html | 1 + tp/urls.py | 1 + 18 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 about/__init__.py create mode 100644 about/admin.py create mode 100644 about/apps.py create mode 100644 about/migrations/__init__.py create mode 100644 about/models.py create mode 100644 about/templates/about/apps.html create mode 100644 about/tests.py create mode 100644 about/urls.py create mode 100644 about/views.py diff --git a/about/__init__.py b/about/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/about/admin.py b/about/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/about/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/about/apps.py b/about/apps.py new file mode 100644 index 0000000..d0190e6 --- /dev/null +++ b/about/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class AboutConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'about' diff --git a/about/migrations/__init__.py b/about/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/about/models.py b/about/models.py new file mode 100644 index 0000000..0b4331b --- /dev/null +++ b/about/models.py @@ -0,0 +1,3 @@ +# from django.db import models + +# Create your models here. diff --git a/about/templates/about/apps.html b/about/templates/about/apps.html new file mode 100644 index 0000000..fd5baae --- /dev/null +++ b/about/templates/about/apps.html @@ -0,0 +1,27 @@ +{% extends "base.html" %} + +{% block content %} + {% include "base_navbar.html" %} + {% include "base_heading.html" %} +
+
+
+
+
+

Native Android Application

+

+ + You can consume and listen to the audiobooks now using my new native Android Application, Trent Reads. + +

+

Podcast Applications

+

+ You can also subscribe to each AudioBook individually as a podcast feed using a podcast client. + Copy and paste the link for the associated feed into a podcast client. +

+
+
+
+
+
+{% endblock content %} diff --git a/about/tests.py b/about/tests.py new file mode 100644 index 0000000..a79ca8b --- /dev/null +++ b/about/tests.py @@ -0,0 +1,3 @@ +# from django.test import TestCase + +# Create your tests here. diff --git a/about/urls.py b/about/urls.py new file mode 100644 index 0000000..fbb4539 --- /dev/null +++ b/about/urls.py @@ -0,0 +1,8 @@ +from django.urls import path +from . import views + +app_name = "about" + +urlpatterns = [ + path('apps/', views.apps, name='apps'), +] diff --git a/about/views.py b/about/views.py new file mode 100644 index 0000000..aef143f --- /dev/null +++ b/about/views.py @@ -0,0 +1,5 @@ +from django.shortcuts import render + + +def apps(request): + return render(request, 'about/apps.html') diff --git a/audio/apps.py b/audio/apps.py index cda5238..15fa721 100644 --- a/audio/apps.py +++ b/audio/apps.py @@ -2,4 +2,5 @@ from django.apps import AppConfig class AudioConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' name = 'audio' diff --git a/audio/templates/audio/feeds.html b/audio/templates/audio/feeds.html index 64b0e53..32bf181 100644 --- a/audio/templates/audio/feeds.html +++ b/audio/templates/audio/feeds.html @@ -23,7 +23,8 @@

{{ i.created_on }}

Items

-

PodCast

+

Apps

+

Pod

license/attribution diff --git a/audio/templates/audio/index.html b/audio/templates/audio/index.html index 843f971..60c7555 100644 --- a/audio/templates/audio/index.html +++ b/audio/templates/audio/index.html @@ -47,7 +47,8 @@

Feed

Pod

{% else %} -

PodCast

+

Apps

+

Pod

{% endif %} license/attribution diff --git a/audio/views.py b/audio/views.py index 1af291e..4eeeed7 100644 --- a/audio/views.py +++ b/audio/views.py @@ -34,8 +34,9 @@ def episode(request, pk, slug): return render( request, 'audio/index.html', { - 'episodes': (episode, ), 'IMAGES_URL': IMAGES_URL, 'is_episode': True, - 'MP3_URL': MP3_URL, 'title': episode.title, 'heading': episode.title, + 'episodes': (episode, ), 'IMAGES_URL': IMAGES_URL, + 'is_episode': True, 'MP3_URL': MP3_URL, + 'title': episode.title, 'heading': episode.title, 'ogtitle': episode.title, 'ogurl': og_url, 'ogmp3': episode.mp3, 'feed': episode.feed, 'twitter_image': episode.image, }) @@ -53,9 +54,10 @@ def feed_list_api(request): feeds = Feed.objects.all().order_by('created_on') result = [] for feed in feeds: + x = reverse('audio:rss', kwargs={'slug': feed.slug}) result.append({ 'title': feed.title, 'read_by': feed.user.username, - 'rss_feed': f'{get_current_site(request)}' + reverse('audio:rss', kwargs={'slug': feed.slug}) + 'rss_feed': f'{get_current_site(request)}' + x }) return JsonResponse(result, safe=False) diff --git a/tp/settings.py b/tp/settings.py index 1126674..701a48a 100644 --- a/tp/settings.py +++ b/tp/settings.py @@ -33,6 +33,7 @@ INSTALLED_APPS = [ 'crispy_forms', 'audio.apps.AudioConfig', 'accounts.apps.AccountsConfig', + 'about.apps.AboutConfig', 'storages', ] diff --git a/tp/templates/base.html b/tp/templates/base.html index a4ae3d0..4cd38e8 100644 --- a/tp/templates/base.html +++ b/tp/templates/base.html @@ -16,6 +16,7 @@ {% url 'audio:new_feed' as new_feed_url %} {% url 'audio:feeds' as feeds_url %} {% url 'accounts:register' as register_url %} + {% url 'about:apps' as apps_url %} {% if request.path == home_url %} Home @@ -37,6 +38,8 @@ Feeds {% elif request.path == register_url %} Register + {% elif request.path == apps_url %} + Applications {% endif %} {{ title }} diff --git a/tp/templates/base_heading.html b/tp/templates/base_heading.html index 8f7e13f..215d637 100644 --- a/tp/templates/base_heading.html +++ b/tp/templates/base_heading.html @@ -1,18 +1,9 @@

- {% url 'accounts:login' as login_url %} - {% url 'accounts:edit_profile' as edit_profile_url %} - {% url 'accounts:password_change' as password_change_url %} - {% url 'accounts:enable_totp' as enable_totp_url %} - {% url 'accounts:disable_totp' as disable_totp_url %} - {% url 'audio:new_feed' as new_feed_url %} - {% url 'audio:feeds' as feeds_url %} - {% url 'audio:home' as home_url %} {% url 'accounts:password_reset' as password_reset_url %} {% url 'accounts:password_reset_done' as password_reset_done_url %} {% url 'accounts:password_reset_complete' as password_reset_complete_url %} - {% url 'accounts:register' as register_url %} {% if request.path == login_url %} Login? @@ -38,6 +29,8 @@ Password Reset Complete {% elif request.path == register_url %} Register? + {% elif request.path == apps_url %} + Applications {% endif %} {{ heading }} diff --git a/tp/templates/base_navbar.html b/tp/templates/base_navbar.html index c910849..10540ae 100644 --- a/tp/templates/base_navbar.html +++ b/tp/templates/base_navbar.html @@ -7,6 +7,7 @@