Skip to content

Commit

Permalink
fix: fulltext.__str__, mkdocs docker, svg formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
griff-rees committed Jan 20, 2024
1 parent 44bc2c6 commit d63b056
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .envs/local
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ REDIS_URL=redis://redis:6379/0
CELERY_FLOWER_USER=aePSKkcANYKRklVrFMzjQPlsHXUrQEzV
CELERY_FLOWER_PASSWORD=Ykr75MuBE22sphvBlNzqLkLWRFD9NcnIbAnYkGbQARde4MViE1z6dKQDDafMtmCf

VIRTUAL_HOST=20.90.118.144

# HTTPS
# ------------------------------------------------------------------------------
# VIRTUAL_HOST=lwmdb-test.local
Expand Down
2 changes: 1 addition & 1 deletion compose/local/docs/start
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -o pipefail
set -o nounset

# make livehtml
mkdocs serve --dev-addr=0.0.0.0:8000
mkdocs serve -a --dev-addr=0.0.0.0:9000
7 changes: 5 additions & 2 deletions local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
env_file:
- ./.envs/local
ports:
# - '8000:8000'
- '8000:8000'
- '9090:9090' # For Jupyter
command: /start

Expand Down Expand Up @@ -88,7 +88,10 @@ services:
volumes:
- .:/app:z
ports:
- '9000:8000'
# upstream
# - '9000:8000'
# server
- '9000:9000'
# command: serve --dev-addr=0.0.0.0:8000

mailpit:
Expand Down
Binary file modified lwmdb/static/images/LWM-Tablet-Banners-2500x1302.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions lwmdb/templates/admin/base_site.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{% extends "admin/base_site.html" %}
{% load static %}
{% block extrahead %}
<link rel="icon" href="{% static 'images/favicons/favicon.ico' %}" />
{% endblock %}
3 changes: 2 additions & 1 deletion newspapers/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from .models import DataProvider, Digitisation, Ingest, Issue, Item, Newspaper
from .models import DataProvider, Digitisation, FullText, Ingest, Issue, Item, Newspaper


class IssueAdmin(admin.TabularInline):
Expand All @@ -18,3 +18,4 @@ class NewspaperAdmin(admin.ModelAdmin):
admin.site.register(Digitisation)
admin.site.register(Ingest)
admin.site.register(Item)
admin.site.register(FullText)
16 changes: 16 additions & 0 deletions newspapers/migrations/0003_alter_fulltext_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Generated by Django 4.2.7 on 2024-01-18 13:40

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("newspapers", "0002_fulltext"),
]

operations = [
migrations.AlterModelOptions(
name="fulltext",
options={"verbose_name": "full text", "verbose_name_plural": "full texts"},
),
]
15 changes: 15 additions & 0 deletions newspapers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,21 @@ class FullText(NewspapersModel):
info = models.TextField(blank=True, null=True)
canonical = models.BooleanField(default=False)

STR_PREFIX: str = "FullText: "

class Meta:
verbose_name: str = "full text"
verbose_name_plural: str = "full texts"

def __str__(self) -> str:
"""Return self.item str if available, else truncated start of text."""
if self.item:
return self.STR_PREFIX + str(self.item)
else:
return self.STR_PREFIX + truncate_str(
self.text, max_length=MAX_PRINT_SELF_STR_LENGTH
)

@property
def file_name(self) -> str:
"""If `self.text_path`, infer file name, else return ''."""
Expand Down

0 comments on commit d63b056

Please sign in to comment.