Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/internal/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from users.models import User
from web.widgets import (
SemanticDateInput,
SemanticDateTimeInput,
SemanticMultipleSelectInput,
SemanticSearchableChoiceInput,
)
Expand Down Expand Up @@ -192,7 +193,7 @@ class Meta:
class QuoteForm(forms.ModelForm):
class Meta:
model = Quote
fields = ("quote", "quoted", "context", "date")
fields = ("quote", "quoted", "context", "time")
widgets = {
"date": SemanticDateInput(),
"time": SemanticDateTimeInput(),
}
26 changes: 26 additions & 0 deletions src/internal/migrations/0027_alter_quote_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 4.2.9 on 2025-10-09 15:44

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("internal", "0026_add_secret_permissions"),
]

operations = [
migrations.RenameField(
model_name="quote",
old_name="date",
new_name="time",
),
migrations.AlterField(
model_name="quote",
name="time",
field=models.DateTimeField(verbose_name="-time it was said"),
),
migrations.AlterModelOptions(
name="quote",
options={"ordering": ("-time",)},
),
]
4 changes: 2 additions & 2 deletions src/internal/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ class Quote(models.Model):
help_text=_("The person who is quoted."),
)
context = models.TextField(blank=True, max_length=500, verbose_name=_("context"))
date = models.DateField(verbose_name=_("date"))
time = models.DateTimeField(verbose_name=_("time it was said"))
author = models.ForeignKey(
to=User,
on_delete=models.CASCADE,
Expand All @@ -371,7 +371,7 @@ class Quote(models.Model):
)

class Meta:
ordering = ("-date",)
ordering = ("-time",)

def __str__(self):
return _("“{quote}” —{quoted}").format(quote=self.quote, quoted=self.quoted)
2 changes: 1 addition & 1 deletion src/internal/templates/internal/quote_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h1 class="ui header">
</div>
<div class="extra content">
<span class="right floated">
{{ quote.date }}
{{ quote.time }}
</span>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/internal/tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ def setUp(self):
self.secrets = (self.secret1, self.secret2)

self.quote1 = Quote.objects.create(
quote="Ha ha.", quoted="Human 1", author=member_user, date="2022-02-02"
quote="Ha ha.", quoted="Human 1", author=member_user, time="2022-02-02"
)
self.quote2 = Quote.objects.create(
quote="I like human humor.",
quoted="Human 2",
author=member_editor_user,
date="2022-02-02",
time="2022-02-02",
)
self.quotes = (self.quote1, self.quote2)

Expand Down
2 changes: 1 addition & 1 deletion src/internal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class QuoteListView(ListView):
model = Quote
template_name = "internal/quote_list.html"
context_object_name = "quotes"
queryset = Quote.objects.order_by("-date").select_related("author")
queryset = Quote.objects.order_by("-time").select_related("author")


class QuoteFormMixin(CustomFieldsetFormMixin, ABC):
Expand Down
Binary file modified src/locale/nb/LC_MESSAGES/django.mo
Binary file not shown.
Loading