Rename "signup deadline" -> "response deadline."
This commit is contained in:
parent
7c7ffee1f3
commit
660c1e75e6
|
@ -18,7 +18,7 @@ class RaidCommentInline(admin.TabularInline):
|
|||
|
||||
@admin.register(Raid)
|
||||
class RaidAdmin(admin.ModelAdmin):
|
||||
list_display = ["title", "date", "signup_deadline"]
|
||||
list_display = ["title", "date", "response_deadline"]
|
||||
search_fields = ["title"]
|
||||
inlines = [RaidResponseInline, RaidCommentInline]
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class RaidResponseForm(ModelForm):
|
|||
class RaidForm(ModelForm):
|
||||
class Meta:
|
||||
model = Raid
|
||||
fields = ["title", "description", "date", "signup_deadline"]
|
||||
fields = ["title", "description", "date", "response_deadline"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
@ -78,7 +78,7 @@ class RaidForm(ModelForm):
|
|||
Field("description"),
|
||||
Row(
|
||||
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
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
@ -17,7 +17,7 @@ class Migration(migrations.Migration):
|
|||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=100, unique=True)),
|
||||
('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')),
|
||||
],
|
||||
options={
|
||||
|
@ -31,7 +31,7 @@ class Migration(migrations.Migration):
|
|||
('title', models.CharField(max_length=40)),
|
||||
('description', models.TextField(blank=True, null=True)),
|
||||
('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={
|
||||
'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.db import migrations, models
|
|
@ -1,3 +1,5 @@
|
|||
from datetime import timedelta
|
||||
|
||||
from django.conf import settings
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db import models
|
||||
|
@ -16,18 +18,19 @@ class Raid(models.Model):
|
|||
)
|
||||
|
||||
date = models.DateTimeField()
|
||||
signup_deadline = models.DateTimeField(
|
||||
response_deadline = models.DateTimeField(
|
||||
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:
|
||||
ordering = ["-date"]
|
||||
|
||||
def clean(self):
|
||||
# Set the signup deadline to the date/time of the raid if it hasn't been set already
|
||||
if self.signup_deadline is None:
|
||||
self.signup_deadline = self.date
|
||||
def save(self, *args, **kwargs):
|
||||
if self.response_deadline is None:
|
||||
self.response_deadline = self.date - timedelta(hours=24)
|
||||
|
||||
return super().save(*args, **kwargs)
|
||||
|
||||
def __str__(self):
|
||||
return f"{self.title} on {self.date}"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</h4>
|
||||
<div class="card-body">
|
||||
<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>
|
||||
{% if response_form %}
|
||||
|
|
|
@ -83,7 +83,7 @@ class RaidDetailView(SingleObjectMixin, MultiModelFormView):
|
|||
classes = {
|
||||
"comment_form": RaidCommentForm
|
||||
}
|
||||
if self.object.signup_deadline > timezone.now():
|
||||
if self.object.response_deadline > timezone.now():
|
||||
classes["response_form"] = RaidResponseForm
|
||||
return classes
|
||||
|
||||
|
|
Loading…
Reference in a new issue