dev #2
25
backlogger/migrations/0006_item_category_unending.py
Normal file
25
backlogger/migrations/0006_item_category_unending.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('backlogger', '0005_item_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='item',
|
||||
name='category',
|
||||
field=models.CharField(
|
||||
choices=[
|
||||
('games', 'Games'),
|
||||
('books', 'Books'),
|
||||
('films', 'Films'),
|
||||
('unending', 'Unending'),
|
||||
('other', 'Other'),
|
||||
],
|
||||
max_length=10,
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -6,11 +6,13 @@ class Item(models.Model):
|
||||
GAMES = 'games'
|
||||
BOOKS = 'books'
|
||||
FILMS = 'films'
|
||||
UNENDING = 'unending'
|
||||
OTHER = 'other'
|
||||
CATEGORY_CHOICES = [
|
||||
(GAMES, 'Games'),
|
||||
(BOOKS, 'Books'),
|
||||
(FILMS, 'Films'),
|
||||
(UNENDING, 'Unending'),
|
||||
(OTHER, 'Other'),
|
||||
]
|
||||
|
||||
|
||||
@@ -252,7 +252,9 @@
|
||||
|
||||
function updateSections() {
|
||||
document.querySelectorAll('.cat-section').forEach(el => el.style.display = 'none');
|
||||
const sec = document.getElementById('section-' + catSelect.value);
|
||||
const cat = catSelect.value;
|
||||
const secId = cat === 'unending' ? 'section-games' : 'section-' + cat;
|
||||
const sec = document.getElementById(secId);
|
||||
if (sec) sec.style.display = 'block';
|
||||
}
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
.badge-games { background: #3b2f6a; color: #a78bfa; }
|
||||
.badge-books { background: #064e3b; color: #34d399; }
|
||||
.badge-films { background: #431407; color: #fb923c; }
|
||||
.badge-unending { background: #0c3a52; color: #38bdf8; }
|
||||
.badge-other { background: #1e293b; color: #94a3b8; }
|
||||
.star { color: #fbbf24; font-size: 0.9rem; margin-left: auto; }
|
||||
|
||||
@@ -233,6 +234,10 @@
|
||||
{% if item.pages_read is not None %}
|
||||
{{ item.pages_read }} pages{% if item.total_pages %} / {{ item.total_pages }} total{% endif %}
|
||||
{% endif %}
|
||||
{% elif item.category == 'unending' %}
|
||||
{% if item.hours_played is not None %}
|
||||
{{ item.hours_played|floatformat:1 }}h played
|
||||
{% endif %}
|
||||
{% elif item.category == 'films' %}
|
||||
{% if item.watched %}✓ Watched{% else %}○ Not watched{% endif %}{% if item.duration_minutes %} · {{ item.duration_minutes }} min{% endif %}
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user