Rename "signup deadline" -> "response deadline."
This commit is contained in:
parent
7c7ffee1f3
commit
660c1e75e6
7 changed files with 18 additions and 15 deletions
|
@ -18,7 +18,7 @@ class RaidCommentInline(admin.TabularInline):
|
||||||
|
|
||||||
@admin.register(Raid)
|
@admin.register(Raid)
|
||||||
class RaidAdmin(admin.ModelAdmin):
|
class RaidAdmin(admin.ModelAdmin):
|
||||||
list_display = ["title", "date", "signup_deadline"]
|
list_display = ["title", "date", "response_deadline"]
|
||||||
search_fields = ["title"]
|
search_fields = ["title"]
|
||||||
inlines = [RaidResponseInline, RaidCommentInline]
|
inlines = [RaidResponseInline, RaidCommentInline]
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ class RaidResponseForm(ModelForm):
|
||||||
class RaidForm(ModelForm):
|
class RaidForm(ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Raid
|
model = Raid
|
||||||
fields = ["title", "description", "date", "signup_deadline"]
|
fields = ["title", "description", "date", "response_deadline"]
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
@ -78,7 +78,7 @@ class RaidForm(ModelForm):
|
||||||
Field("description"),
|
Field("description"),
|
||||||
Row(
|
Row(
|
||||||
Column("date", css_class="form-group col-md-6"),
|
Column("date", css_class="form-group col-md-6"),
|
||||||
Column("signup_deadline", css_class="form-group col-md-6"),
|
Column("response_deadline", css_class="form-group col-md-6"),
|
||||||
),
|
),
|
||||||
submit_button
|
submit_button
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 2.2.6 on 2019-10-25 01:58
|
# Generated by Django 2.2.6 on 2019-10-25 13:23
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class Migration(migrations.Migration):
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('name', models.CharField(max_length=100, unique=True)),
|
('name', models.CharField(max_length=100, unique=True)),
|
||||||
('date', models.DateField(help_text='Some date where the instance was reset in the past.')),
|
('date', models.DateField(help_text='Some date where the instance was reset in the past.')),
|
||||||
('time', models.TimeField()),
|
('time', models.TimeField(help_text='The time of day where the instance resets.')),
|
||||||
('duration', models.DurationField(help_text='Resets are calculated from the given date in intervals of this duration.', verbose_name='lockout duration')),
|
('duration', models.DurationField(help_text='Resets are calculated from the given date in intervals of this duration.', verbose_name='lockout duration')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
@ -31,7 +31,7 @@ class Migration(migrations.Migration):
|
||||||
('title', models.CharField(max_length=40)),
|
('title', models.CharField(max_length=40)),
|
||||||
('description', models.TextField(blank=True, null=True)),
|
('description', models.TextField(blank=True, null=True)),
|
||||||
('date', models.DateTimeField()),
|
('date', models.DateTimeField()),
|
||||||
('signup_deadline', models.DateTimeField(blank=True, help_text='Defaults to date and time of raid if not set.')),
|
('response_deadline', models.DateTimeField(blank=True, help_text='Defaults to 24 hours before date and time of raid if not set.')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
'ordering': ['-date'],
|
'ordering': ['-date'],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 2.2.6 on 2019-10-25 01:58
|
# Generated by Django 2.2.6 on 2019-10-25 13:23
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
|
@ -1,3 +1,5 @@
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
@ -16,18 +18,19 @@ class Raid(models.Model):
|
||||||
)
|
)
|
||||||
|
|
||||||
date = models.DateTimeField()
|
date = models.DateTimeField()
|
||||||
signup_deadline = models.DateTimeField(
|
response_deadline = models.DateTimeField(
|
||||||
blank=True,
|
blank=True,
|
||||||
help_text="Defaults to date and time of raid if not set."
|
help_text="Defaults to 24 hours before date and time of raid if not set."
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["-date"]
|
ordering = ["-date"]
|
||||||
|
|
||||||
def clean(self):
|
def save(self, *args, **kwargs):
|
||||||
# Set the signup deadline to the date/time of the raid if it hasn't been set already
|
if self.response_deadline is None:
|
||||||
if self.signup_deadline is None:
|
self.response_deadline = self.date - timedelta(hours=24)
|
||||||
self.signup_deadline = self.date
|
|
||||||
|
return super().save(*args, **kwargs)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.title} on {self.date}"
|
return f"{self.title} on {self.date}"
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</h4>
|
</h4>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<p class="card-text">{{ raid.description | linebreaksbr | default:"<em>No description</em>" }}</p>
|
<p class="card-text">{{ raid.description | linebreaksbr | default:"<em>No description</em>" }}</p>
|
||||||
<p class="card-text"><small class="text-muted">Sign up deadline: {{ raid.signup_deadline }}</small></p>
|
<p class="card-text"><small class="text-muted">Response deadline: {{ raid.response_deadline }}</small></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if response_form %}
|
{% if response_form %}
|
||||||
|
|
|
@ -83,7 +83,7 @@ class RaidDetailView(SingleObjectMixin, MultiModelFormView):
|
||||||
classes = {
|
classes = {
|
||||||
"comment_form": RaidCommentForm
|
"comment_form": RaidCommentForm
|
||||||
}
|
}
|
||||||
if self.object.signup_deadline > timezone.now():
|
if self.object.response_deadline > timezone.now():
|
||||||
classes["response_form"] = RaidResponseForm
|
classes["response_form"] = RaidResponseForm
|
||||||
return classes
|
return classes
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue