mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-25 19:11:09 +00:00
parent
597378bb78
commit
6cd2c91135
4 changed files with 36 additions and 11 deletions
23
bookwyrm/migrations/0192_make_page_positions_text.py
Normal file
23
bookwyrm/migrations/0192_make_page_positions_text.py
Normal file
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -338,11 +338,13 @@ class Quotation(BookStatus):
|
||||||
|
|
||||||
quote = fields.HtmlField()
|
quote = fields.HtmlField()
|
||||||
raw_quote = models.TextField(blank=True, null=True)
|
raw_quote = models.TextField(blank=True, null=True)
|
||||||
position = models.IntegerField(
|
position = models.TextField(
|
||||||
validators=[MinValueValidator(0)], null=True, blank=True
|
null=True,
|
||||||
|
blank=True,
|
||||||
)
|
)
|
||||||
endposition = models.IntegerField(
|
endposition = models.TextField(
|
||||||
validators=[MinValueValidator(0)], null=True, blank=True
|
null=True,
|
||||||
|
blank=True,
|
||||||
)
|
)
|
||||||
position_mode = models.CharField(
|
position_mode = models.CharField(
|
||||||
max_length=3,
|
max_length=3,
|
||||||
|
|
|
@ -56,8 +56,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
|
||||||
<input
|
<input
|
||||||
aria-label="{% if draft.position_mode == 'PG' %}Page{% else %}Percent{% endif %}"
|
aria-label="{% if draft.position_mode == 'PG' %}Page{% else %}Percent{% endif %}"
|
||||||
class="input"
|
class="input"
|
||||||
type="number"
|
type="text"
|
||||||
min="0"
|
|
||||||
name="position"
|
name="position"
|
||||||
size="3"
|
size="3"
|
||||||
value="{% firstof draft.position '' %}"
|
value="{% firstof draft.position '' %}"
|
||||||
|
@ -72,8 +71,7 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
|
||||||
<input
|
<input
|
||||||
aria-label="{% if draft.position_mode == 'PG' %}Page{% else %}Percent{% endif %}"
|
aria-label="{% if draft.position_mode == 'PG' %}Page{% else %}Percent{% endif %}"
|
||||||
class="input"
|
class="input"
|
||||||
type="number"
|
type="text"
|
||||||
min="0"
|
|
||||||
name="endposition"
|
name="endposition"
|
||||||
size="3"
|
size="3"
|
||||||
value="{% firstof draft.endposition '' %}"
|
value="{% firstof draft.endposition '' %}"
|
||||||
|
|
|
@ -272,8 +272,8 @@ class BookViews(TestCase):
|
||||||
book=self.book,
|
book=self.book,
|
||||||
content="hi",
|
content="hi",
|
||||||
quote="wow",
|
quote="wow",
|
||||||
position=12,
|
position="12",
|
||||||
endposition=13,
|
endposition="13",
|
||||||
)
|
)
|
||||||
|
|
||||||
request = self.factory.get("")
|
request = self.factory.get("")
|
||||||
|
@ -286,7 +286,9 @@ class BookViews(TestCase):
|
||||||
validate_html(result.render())
|
validate_html(result.render())
|
||||||
print(result.render())
|
print(result.render())
|
||||||
self.assertEqual(result.status_code, 200)
|
self.assertEqual(result.status_code, 200)
|
||||||
self.assertEqual(result.context_data["statuses"].object_list[0].endposition, 13)
|
self.assertEqual(
|
||||||
|
result.context_data["statuses"].object_list[0].endposition, "13"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _setup_cover_url():
|
def _setup_cover_url():
|
||||||
|
|
Loading…
Reference in a new issue