Skip to content

Commit

Permalink
Allow page numbers to be text, instead of integers.
Browse files Browse the repository at this point in the history
  • Loading branch information
WesleyAC committed Jan 5, 2024
1 parent 597378b commit 31e7471
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 8 deletions.
23 changes: 23 additions & 0 deletions bookwyrm/migrations/0192_make_page_positions_text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 3.2.23 on 2024-01-04 23:56

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("bookwyrm", "0191_merge_20240102_0326"),
]

operations = [
migrations.AlterField(
model_name="quotation",
name="endposition",
field=models.TextField(blank=True, null=True),
),
migrations.AlterField(
model_name="quotation",
name="position",
field=models.TextField(blank=True, null=True),
),
]
10 changes: 6 additions & 4 deletions bookwyrm/models/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,13 @@ class Quotation(BookStatus):

quote = fields.HtmlField()
raw_quote = models.TextField(blank=True, null=True)
position = models.IntegerField(
validators=[MinValueValidator(0)], null=True, blank=True
position = models.TextField(
null=True,
blank=True,
)
endposition = models.IntegerField(
validators=[MinValueValidator(0)], null=True, blank=True
endposition = models.TextField(
null=True,
blank=True,
)
position_mode = models.CharField(
max_length=3,
Expand Down
6 changes: 2 additions & 4 deletions bookwyrm/templates/snippets/create_status/quotation.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@
<input
aria-label="{% if draft.position_mode == 'PG' %}Page{% else %}Percent{% endif %}"
class="input"
type="number"
min="0"
type="text"
name="position"
size="3"
value="{% firstof draft.position '' %}"
Expand All @@ -72,8 +71,7 @@
<input
aria-label="{% if draft.position_mode == 'PG' %}Page{% else %}Percent{% endif %}"
class="input"
type="number"
min="0"
type="text"
name="endposition"
size="3"
value="{% firstof draft.endposition '' %}"
Expand Down

0 comments on commit 31e7471

Please sign in to comment.