Compare commits

...

3 commits

4 changed files with 30 additions and 6 deletions

View file

@ -4,6 +4,7 @@
{% block content %}
<h2>Bank</h2>
<div class="card">
<div class="card-header d-flex">
<div class="nav nav-tabs card-header-tabs mr-auto">

View file

@ -0,0 +1,21 @@
# Generated by Django 3.0.2 on 2020-04-17 08:54
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('raids', '0005_auto_20200106_2305'),
]
operations = [
migrations.AlterField(
model_name='raidcomment',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='raid_comments', to=settings.AUTH_USER_MODEL),
),
]

View file

@ -141,7 +141,7 @@ class RaidComment(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL,
related_name="raid_comments",
on_delete=models.PROTECT,
on_delete=models.CASCADE,
)
body = models.TextField(

View file

@ -19,6 +19,7 @@ User = get_user_model()
class RaidCalendar(MonthArchiveView):
queryset = Raid.objects.all()
allow_empty = True
allow_future = True
date_field = "date"
@ -27,11 +28,12 @@ class RaidCalendar(MonthArchiveView):
template_name_suffix = "_calendar"
def get_queryset(self):
if not self.request.user.is_authenticated:
return Raid.objects.all()
return Raid.objects.annotate(
max_status=Max("responses__status", filter=Q(responses__character__user=self.request.user))
)
queryset = super().get_queryset()
if self.request.user.is_authenticated:
queryset = queryset.annotate(
max_status=Max("responses__status", filter=Q(responses__character__user=self.request.user))
)
return queryset
def get_dated_queryset(self, **lookup):
"""