2024-12-03-Tuesday
created: 2024-12-03 06:23 tags: - daily-notes
Tuesday, December 03, 2024
<< Timestamps/2024/12-December/2024-12-02-Monday|Yesterday | Timestamps/2024/12-December/2024-12-04-Wednesday|Tomorrow >>
🎯 Goal
- [x] Establish a new BookNook App to track progress of books I'm reading
🌟 Results
- Created the BookNook App to help me track my different books
🌱 Next Time
- Move the BigBrain App to be within the
apps
directory of the DIMMiN App
📝 Notes
I wanted to use the Taskmaster App to track the progress of my reading list, but that ended up being too much of a hassle. Therefore, I decided to create a new Django App to cover books that I'm reading to help me track my reading list. This could also be a great time to try out my new app structure where I place applications I use in apps/app_name
directories so that they don't start to clutter my primary app.
I created the app by first creating the apps
directory, then adding a blank __init__.py
so that Django would treat the apps
like a Python Package. Then I created the Django App using
python manage.py startapp booknook apps/booknook
which created my new BookNook App.
Then I just needed to add my BookNook App to my INSTALLED_APPS
list in my config/settings.py
file.
I did have to change my apps/booknook/apps.py
file's Config to have the name
field of apps.booknook
. After this change was made I was in the clear for creating my Database Migrations:
python manage.py makemigrations
python manage.py migrate
I then adjusted the Django Models so that it would be easier to add / configure the different components. Namely, I wanted to filter the books I could select for the BookProgress
model to only books I'm actively reading (flagged by the is_active
boolean):
class BookProgress(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
book = models.ForeignKey(
"Book",
on_delete=models.CASCADE,
related_name="progress",
limit_choices_to={"is_active": True}, # Only show books with is_active=True
)
current_page = models.IntegerField(null=False, blank=False)
recap = CKEditor5Field(config_name="default")
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return f"{self.user.username} - Update for - {self.book.title}"
I've also added the following:
class ReadingList(models.Model):
pass
A ReadingList
will consist of a collection of Books
(like a Playlist is a collection of songs). I may extend this further later on to allow a readinglist to be developed into a Syllabus or ReadingSchedule
so that a user can take a list of books, see the total number of pages or sections or chapters, and see how long it may take them to complete that reading list, maybe calculated via a rate of reading from the past.
I made a few more adjustments before I decided to send it in and push changes to Production. Overall the BookNook App is now live.
I had to apply Database Migrations on the Production side with
heroku run bash -a dimmin
python manage.py migrate
Now the BookNook App is live and ready for updates.
Notes created today
List FROM "" WHERE file.cday = date("2024-12-03") SORT file.ctime asc
Notes last touched today
List FROM "" WHERE file.mday = date("2024-12-03") SORT file.mtime asc