Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
6 changes: 3 additions & 3 deletions src/internal/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from card import utils as card_utils
from card.formfields import CardNumberField
from users.models import User
from web.widgets import SemanticDateInput, SemanticMultipleSelectInput, SemanticSearchableChoiceInput
from web.widgets import SemanticDateInput, SemanticDateTimeInput, SemanticMultipleSelectInput, SemanticSearchableChoiceInput
from .models import Member, Quote, Secret, SystemAccess


Expand Down Expand Up @@ -172,7 +172,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(),
}
27 changes: 27 additions & 0 deletions src/internal/migrations/0027_alter_quote_date.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# 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'),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
field=models.DateTimeField(verbose_name='-time it was said'),
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 @@ -300,7 +300,7 @@ class Quote(models.Model):
quote = models.TextField(verbose_name=_("quote"))
quoted = models.CharField(max_length=100, verbose_name=_("quoted"), 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 @@ -309,7 +309,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 @@ -58,9 +58,9 @@ def setUp(self):
self.secret2 = Secret.objects.create(title="YouTube account", content="<p>Email: make@gmail.com</p><p>Password: password</p>")
self.secrets = (self.secret1, self.secret2)

self.quote1 = Quote.objects.create(quote="Ha ha.", quoted="Human 1", author=member_user, date="2022-02-02")
self.quote1 = Quote.objects.create(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)

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion src/internal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,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