mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-11 17:55:37 +00:00
Added Backend Part
This commit is contained in:
parent
48ac90a984
commit
f085315d70
5 changed files with 45 additions and 2 deletions
|
@ -53,6 +53,7 @@ class QuotationForm(CustomForm):
|
||||||
"sensitive",
|
"sensitive",
|
||||||
"privacy",
|
"privacy",
|
||||||
"position",
|
"position",
|
||||||
|
"endposition",
|
||||||
"position_mode",
|
"position_mode",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
26
bookwyrm/migrations/0174_auto_20230130_1240.py
Normal file
26
bookwyrm/migrations/0174_auto_20230130_1240.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
# Generated by Django 3.2.16 on 2023-01-30 12:40
|
||||||
|
|
||||||
|
import django.core.validators
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('auth', '0012_alter_user_first_name_max_length'),
|
||||||
|
('bookwyrm', '0173_default_user_auth_group_setting'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='quotation',
|
||||||
|
name='endposition',
|
||||||
|
field=models.IntegerField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0)]),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='sitesettings',
|
||||||
|
name='default_user_auth_group',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='auth.group'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -329,6 +329,9 @@ class Quotation(BookStatus):
|
||||||
position = models.IntegerField(
|
position = models.IntegerField(
|
||||||
validators=[MinValueValidator(0)], null=True, blank=True
|
validators=[MinValueValidator(0)], null=True, blank=True
|
||||||
)
|
)
|
||||||
|
endposition = models.IntegerField(
|
||||||
|
validators=[MinValueValidator(0)], null=True, blank=True
|
||||||
|
)
|
||||||
position_mode = models.CharField(
|
position_mode = models.CharField(
|
||||||
max_length=3,
|
max_length=3,
|
||||||
choices=ProgressMode.choices,
|
choices=ProgressMode.choices,
|
||||||
|
|
|
@ -65,6 +65,19 @@ uuid: a unique identifier used to make html "id" attributes unique and clarify j
|
||||||
{% if not draft %}data-cache-draft="id_position_{{ book.id }}_{{ type }}"{% endif %}
|
{% if not draft %}data-cache-draft="id_position_{{ book.id }}_{{ type }}"{% endif %}
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="control">
|
||||||
|
<input
|
||||||
|
aria-label="{% if draft.position_mode == 'PG' %}Page{% else %}Percent{% endif %}"
|
||||||
|
class="input"
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
name="endposition"
|
||||||
|
size="3"
|
||||||
|
value="{% firstof draft.endposition '' %}"
|
||||||
|
id="endposition_{{ uuid }}"
|
||||||
|
{% if not draft %}data-cache-draft="id_endposition_{{ book.id }}_{{ type }}"{% endif %}
|
||||||
|
>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -99,9 +99,9 @@
|
||||||
— {% include 'snippets/book_titleby.html' with book=status.book %}
|
— {% include 'snippets/book_titleby.html' with book=status.book %}
|
||||||
{% if status.position %}
|
{% if status.position %}
|
||||||
{% if status.position_mode == 'PG' %}
|
{% if status.position_mode == 'PG' %}
|
||||||
{% blocktrans with page=status.position|intcomma %}(Page {{ page }}){% endblocktrans %}
|
{% blocktrans with page=status.position|intcomma %}(Page {{ page }}{% endblocktrans%}{% if status.endposition%} - {% blocktrans with endpage=status.endposition|intcomma %}{{ endpage }}{% endblocktrans %}{% endif%})
|
||||||
{% else %}
|
{% else %}
|
||||||
{% blocktrans with percent=status.position %}({{ percent }}%){% endblocktrans %}
|
{% blocktrans with percent=status.position %}({{ percent }}%{% endblocktrans %}{% if status.endposition%}{% blocktrans with endpercent=status.endposition|intcomma %} - {{ endpercent }}%{% endblocktrans %}{% endif %})
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</p>
|
</p>
|
||||||
|
|
Loading…
Reference in a new issue