run pre-commit --all-files, it's been a while since last time

This commit is contained in:
Thomas Steen Rasmussen 2021-07-19 15:06:10 +02:00
parent a21bc1097c
commit 01687ea11a
125 changed files with 623 additions and 397 deletions

View file

@ -1,4 +1,5 @@
from django import forms from django import forms
from program.models import Event, Speaker from program.models import Event, Speaker

View file

@ -1,7 +1,8 @@
from camps.mixins import CampViewMixin
from django.contrib.auth.mixins import UserPassesTestMixin from django.contrib.auth.mixins import UserPassesTestMixin
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from camps.mixins import CampViewMixin
from economy.models import Pos from economy.models import Pos
from utils.mixins import RaisePermissionRequiredMixin from utils.mixins import RaisePermissionRequiredMixin

View file

@ -395,7 +395,9 @@ urlpatterns = [
include( include(
[ [
path( path(
"", SpeakerDetailView.as_view(), name="speaker_detail", "",
SpeakerDetailView.as_view(),
name="speaker_detail",
), ),
path( path(
"update/", "update/",
@ -473,7 +475,11 @@ urlpatterns = [
"<slug:slug>/", "<slug:slug>/",
include( include(
[ [
path("", EventDetailView.as_view(), name="event_detail",), path(
"",
EventDetailView.as_view(),
name="event_detail",
),
path( path(
"update/", "update/",
EventUpdateView.as_view(), EventUpdateView.as_view(),
@ -500,7 +506,11 @@ urlpatterns = [
"autoscheduler/", "autoscheduler/",
include( include(
[ [
path("", AutoScheduleManageView.as_view(), name="autoschedule_manage",), path(
"",
AutoScheduleManageView.as_view(),
name="autoschedule_manage",
),
path( path(
"crashcourse/", "crashcourse/",
AutoScheduleCrashCourseView.as_view(), AutoScheduleCrashCourseView.as_view(),
@ -512,7 +522,9 @@ urlpatterns = [
name="autoschedule_validate", name="autoschedule_validate",
), ),
path( path(
"diff/", AutoScheduleDiffView.as_view(), name="autoschedule_diff", "diff/",
AutoScheduleDiffView.as_view(),
name="autoschedule_diff",
), ),
path( path(
"apply/", "apply/",
@ -539,7 +551,11 @@ urlpatterns = [
name="approve_event_feedback", name="approve_event_feedback",
), ),
# add recording url objects # add recording url objects
path("add_recording", AddRecordingView.as_view(), name="add_eventrecording",), path(
"add_recording",
AddRecordingView.as_view(),
name="add_eventrecording",
),
# economy # economy
path( path(
"economy/", "economy/",
@ -658,18 +674,34 @@ urlpatterns = [
"pos/", "pos/",
include( include(
[ [
path("", PosListView.as_view(), name="pos_list",), path(
path("create/", PosCreateView.as_view(), name="pos_create",), "",
PosListView.as_view(),
name="pos_list",
),
path(
"create/",
PosCreateView.as_view(),
name="pos_create",
),
path( path(
"<slug:pos_slug>/", "<slug:pos_slug>/",
include( include(
[ [
path("", PosDetailView.as_view(), name="pos_detail",),
path( path(
"update/", PosUpdateView.as_view(), name="pos_update", "",
PosDetailView.as_view(),
name="pos_detail",
), ),
path( path(
"delete/", PosDeleteView.as_view(), name="pos_delete", "update/",
PosUpdateView.as_view(),
name="pos_update",
),
path(
"delete/",
PosDeleteView.as_view(),
name="pos_delete",
), ),
path( path(
"reports/", "reports/",
@ -731,14 +763,30 @@ urlpatterns = [
"tokens/", "tokens/",
include( include(
[ [
path("", TokenListView.as_view(), name="token_list",), path(
path("create/", TokenCreateView.as_view(), name="token_create",), "",
path("stats/", TokenStatsView.as_view(), name="token_stats",), TokenListView.as_view(),
name="token_list",
),
path(
"create/",
TokenCreateView.as_view(),
name="token_create",
),
path(
"stats/",
TokenStatsView.as_view(),
name="token_stats",
),
path( path(
"<int:pk>/", "<int:pk>/",
include( include(
[ [
path("", TokenDetailView.as_view(), name="token_detail",), path(
"",
TokenDetailView.as_view(),
name="token_detail",
),
path( path(
"update/", "update/",
TokenUpdateView.as_view(), TokenUpdateView.as_view(),

View file

@ -1,22 +1,20 @@
import logging import logging
import requests import requests
from camps.mixins import CampViewMixin
from django.conf import settings from django.conf import settings
from django.http import Http404, HttpResponse from django.http import Http404, HttpResponse
from django.views.generic import TemplateView from django.views.generic import TemplateView
from facilities.models import (
FacilityFeedback, from camps.mixins import CampViewMixin
) from facilities.models import FacilityFeedback
from teams.models import Team from teams.models import Team
from utils.models import OutgoingEmail from utils.models import OutgoingEmail
from ..mixins import ( from ..mixins import RaisePermissionRequiredMixin
RaisePermissionRequiredMixin,
)
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)
class BackofficeIndexView(CampViewMixin, RaisePermissionRequiredMixin, TemplateView): class BackofficeIndexView(CampViewMixin, RaisePermissionRequiredMixin, TemplateView):
""" """
The Backoffice index view only requires camps.backoffice_permission so we use RaisePermissionRequiredMixin directly The Backoffice index view only requires camps.backoffice_permission so we use RaisePermissionRequiredMixin directly
@ -37,7 +35,14 @@ class BackofficeIndexView(CampViewMixin, RaisePermissionRequiredMixin, TemplateV
) )
) )
) )
context["held_email_count"] = OutgoingEmail.objects.filter(hold=True, responsible_team__isnull=True).count() + OutgoingEmail.objects.filter(hold=True, responsible_team__camp=self.camp).count() context["held_email_count"] = (
OutgoingEmail.objects.filter(
hold=True, responsible_team__isnull=True
).count()
+ OutgoingEmail.objects.filter(
hold=True, responsible_team__camp=self.camp
).count()
)
return context return context

View file

@ -1,24 +1,16 @@
import logging import logging
from camps.mixins import CampViewMixin
from django.contrib import messages from django.contrib import messages
from django.forms import modelformset_factory from django.forms import modelformset_factory
from django.shortcuts import redirect from django.shortcuts import redirect
from django.urls import reverse from django.urls import reverse
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
from program.models import (
Event,
EventFeedback,
Url,
UrlType,
)
from ..forms import ( from camps.mixins import CampViewMixin
AddRecordingForm, from program.models import Event, EventFeedback, Url, UrlType
)
from ..mixins import ( from ..forms import AddRecordingForm
ContentTeamPermissionMixin, from ..mixins import ContentTeamPermissionMixin
)
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)
@ -84,9 +76,7 @@ class AddRecordingView(CampViewMixin, ContentTeamPermissionMixin, FormView):
super().setup(*args, **kwargs) super().setup(*args, **kwargs)
self.queryset = Event.objects.filter( self.queryset = Event.objects.filter(
track__camp=self.camp, video_recording=True track__camp=self.camp, video_recording=True
).exclude( ).exclude(urls__url_type__name="Recording")
urls__url_type__name="Recording"
)
self.form_class = modelformset_factory( self.form_class = modelformset_factory(
Event, Event,
@ -113,19 +103,17 @@ class AddRecordingView(CampViewMixin, ContentTeamPermissionMixin, FormView):
form.save() form.save()
for event_data in form.cleaned_data: for event_data in form.cleaned_data:
if event_data['recording_url']: if event_data["recording_url"]:
url = event_data['recording_url'] url = event_data["recording_url"]
if not event_data['id'].urls.filter(url=url).exists(): if not event_data["id"].urls.filter(url=url).exists():
recording_url = Url() recording_url = Url()
recording_url.event = event_data['id'] recording_url.event = event_data["id"]
recording_url.url = url recording_url.url = url
recording_url.url_type = UrlType.objects.get(name="Recording") recording_url.url_type = UrlType.objects.get(name="Recording")
recording_url.save() recording_url.save()
if form.changed_objects: if form.changed_objects:
messages.success( messages.success(self.request, f"Updated {len(form.changed_objects)} Event")
self.request, f"Updated {len(form.changed_objects)} Event"
)
return redirect(self.get_success_url()) return redirect(self.get_success_url())
def get_success_url(self, *args, **kwargs): def get_success_url(self, *args, **kwargs):

View file

@ -1,7 +1,6 @@
import logging import logging
import os import os
from camps.mixins import CampViewMixin
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.models import User from django.contrib.auth.models import User
@ -12,18 +11,12 @@ from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, DeleteView, UpdateView from django.views.generic.edit import CreateView, DeleteView, UpdateView
from economy.models import (
Chain, from camps.mixins import CampViewMixin
Credebtor, from economy.models import Chain, Credebtor, Expense, Reimbursement, Revenue
Expense,
Reimbursement,
Revenue,
)
from teams.models import Team from teams.models import Team
from ..mixins import ( from ..mixins import EconomyTeamPermissionMixin
EconomyTeamPermissionMixin,
)
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)
@ -448,5 +441,3 @@ class RevenueDetailView(CampViewMixin, EconomyTeamPermissionMixin, UpdateView):
return redirect( return redirect(
reverse("backoffice:revenue_list", kwargs={"camp_slug": self.camp.slug}) reverse("backoffice:revenue_list", kwargs={"camp_slug": self.camp.slug})
) )

View file

@ -1,6 +1,5 @@
import logging import logging
from camps.mixins import CampViewMixin
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
@ -9,19 +8,18 @@ from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse from django.urls import reverse
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, DeleteView, FormView, UpdateView from django.views.generic.edit import CreateView, DeleteView, FormView, UpdateView
from leaflet.forms.widgets import LeafletWidget
from camps.mixins import CampViewMixin
from facilities.models import ( from facilities.models import (
Facility, Facility,
FacilityFeedback, FacilityFeedback,
FacilityOpeningHours, FacilityOpeningHours,
FacilityType, FacilityType,
) )
from leaflet.forms.widgets import LeafletWidget
from teams.models import Team from teams.models import Team
from ..mixins import ( from ..mixins import OrgaTeamPermissionMixin, RaisePermissionRequiredMixin
OrgaTeamPermissionMixin,
RaisePermissionRequiredMixin,
)
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)
@ -320,5 +318,3 @@ class FacilityOpeningHoursDeleteView(
"backoffice:facility_detail", "backoffice:facility_detail",
kwargs={"camp_slug": self.camp.slug, "facility_uuid": self.facility.pk}, kwargs={"camp_slug": self.camp.slug, "facility_uuid": self.facility.pk},
) )

View file

@ -1,6 +1,5 @@
import logging import logging
from camps.mixins import CampViewMixin
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db.models import Count, Q from django.db.models import Count, Q
@ -8,11 +7,11 @@ from django.shortcuts import redirect
from django.urls import reverse from django.urls import reverse
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, DeleteView, UpdateView from django.views.generic.edit import CreateView, DeleteView, UpdateView
from camps.mixins import CampViewMixin
from tokens.models import Token, TokenFind from tokens.models import Token, TokenFind
from ..mixins import ( from ..mixins import RaisePermissionRequiredMixin
RaisePermissionRequiredMixin,
)
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -1,16 +1,15 @@
import logging import logging
from itertools import chain from itertools import chain
from camps.mixins import CampViewMixin
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import ListView, TemplateView from django.views.generic import ListView, TemplateView
from camps.mixins import CampViewMixin
from shop.models import Order, OrderProductRelation from shop.models import Order, OrderProductRelation
from tickets.models import DiscountTicket, ShopTicket, SponsorTicket, TicketType from tickets.models import DiscountTicket, ShopTicket, SponsorTicket, TicketType
from ..mixins import ( from ..mixins import InfoTeamPermissionMixin
InfoTeamPermissionMixin,
)
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)
@ -140,7 +139,9 @@ class ScanTicketsView(
messages.success(request, "Order #{} has been marked as paid!".format(order.id)) messages.success(request, "Order #{} has been marked as paid!".format(order.id))
class ShopTicketOverview(LoginRequiredMixin, InfoTeamPermissionMixin, CampViewMixin, ListView): class ShopTicketOverview(
LoginRequiredMixin, InfoTeamPermissionMixin, CampViewMixin, ListView
):
model = ShopTicket model = ShopTicket
template_name = "shop_ticket_overview.html" template_name = "shop_ticket_overview.html"
context_object_name = "shop_tickets" context_object_name = "shop_tickets"

View file

@ -1,6 +1,5 @@
import logging import logging
from camps.mixins import CampViewMixin
from django.contrib import messages from django.contrib import messages
from django.forms import modelformset_factory from django.forms import modelformset_factory
from django.shortcuts import redirect from django.shortcuts import redirect
@ -8,13 +7,13 @@ from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.views.generic import ListView, TemplateView from django.views.generic import ListView, TemplateView
from django.views.generic.edit import FormView from django.views.generic.edit import FormView
from camps.mixins import CampViewMixin
from profiles.models import Profile from profiles.models import Profile
from shop.models import OrderProductRelation from shop.models import OrderProductRelation
from utils.models import OutgoingEmail from utils.models import OutgoingEmail
from ..mixins import ( from ..mixins import OrgaTeamPermissionMixin
OrgaTeamPermissionMixin,
)
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)
@ -28,6 +27,7 @@ class ApproveNamesView(CampViewMixin, OrgaTeamPermissionMixin, ListView):
public_credit_name="" public_credit_name=""
) )
################################ ################################
# MERCHANDISE VIEWS # MERCHANDISE VIEWS

View file

@ -1,23 +1,17 @@
import logging import logging
from camps.mixins import CampViewMixin
from django.contrib import messages from django.contrib import messages
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
from django.shortcuts import redirect from django.shortcuts import redirect
from django.urls import reverse from django.urls import reverse
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView, DeleteView, UpdateView from django.views.generic.edit import CreateView, DeleteView, UpdateView
from economy.models import (
Pos, from camps.mixins import CampViewMixin
PosReport, from economy.models import Pos, PosReport
)
from teams.models import Team from teams.models import Team
from ..mixins import ( from ..mixins import OrgaTeamPermissionMixin, PosViewMixin, RaisePermissionRequiredMixin
OrgaTeamPermissionMixin,
PosViewMixin,
RaisePermissionRequiredMixin,
)
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -1,6 +1,5 @@
import logging import logging
from camps.mixins import CampViewMixin
from django import forms from django import forms
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
@ -10,6 +9,8 @@ from django.urls import reverse
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.views.generic import DetailView, ListView, TemplateView from django.views.generic import DetailView, ListView, TemplateView
from django.views.generic.edit import CreateView, DeleteView, FormView, UpdateView from django.views.generic.edit import CreateView, DeleteView, FormView, UpdateView
from camps.mixins import CampViewMixin
from program.autoscheduler import AutoScheduler from program.autoscheduler import AutoScheduler
from program.mixins import AvailabilityMatrixViewMixin from program.mixins import AvailabilityMatrixViewMixin
from program.models import ( from program.models import (
@ -30,9 +31,7 @@ from ..forms import (
EventScheduleForm, EventScheduleForm,
SpeakerForm, SpeakerForm,
) )
from ..mixins import ( from ..mixins import ContentTeamPermissionMixin
ContentTeamPermissionMixin,
)
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -1,4 +1,5 @@
from django.db import models from django.db import models
from utils.models import CampRelatedModel from utils.models import CampRelatedModel

View file

@ -1,6 +1,7 @@
from camps.mixins import CampViewMixin
from django.views.generic import ListView from django.views.generic import ListView
from camps.mixins import CampViewMixin
from .models import ProductCategory from .models import ProductCategory

View file

@ -1,6 +1,7 @@
from channels.auth import AuthMiddlewareStack from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter from channels.routing import ProtocolTypeRouter, URLRouter
from django.conf.urls import url from django.conf.urls import url
from program.consumers import ScheduleConsumer from program.consumers import ScheduleConsumer
application = ProtocolTypeRouter( application = ProtocolTypeRouter(

View file

@ -1,7 +1,8 @@
from camps.models import Camp
from graphene import ObjectType, Schema, relay from graphene import ObjectType, Schema, relay
from graphene_django import DjangoObjectType from graphene_django import DjangoObjectType
from graphene_django.filter import DjangoFilterConnectionField from graphene_django.filter import DjangoFilterConnectionField
from camps.models import Camp
from program.schema import ProgramQuery from program.schema import ProgramQuery

View file

@ -203,4 +203,4 @@ DATA_UPLOAD_MAX_NUMBER_FIELDS = 5000
ACCOUNT_SIGNUP_FORM_CLASS = "bornhack.forms.AllAuthSignupCaptchaForm" ACCOUNT_SIGNUP_FORM_CLASS = "bornhack.forms.AllAuthSignupCaptchaForm"
# django 3.2 https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys # django 3.2 https://docs.djangoproject.com/en/3.2/releases/3.2/#customizing-type-of-auto-created-primary-keys
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

View file

@ -1,12 +1,13 @@
from allauth.account.views import LoginView, LogoutView from allauth.account.views import LoginView, LogoutView
from bar.views import MenuView
from camps.views import CampDetailView, CampListView, CampRedirectView
from django.conf import settings from django.conf import settings
from django.conf.urls import include from django.conf.urls import include
from django.contrib import admin from django.contrib import admin
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.urls import path from django.urls import path
from django.views.generic import TemplateView from django.views.generic import TemplateView
from bar.views import MenuView
from camps.views import CampDetailView, CampListView, CampRedirectView
from feedback.views import FeedbackCreate from feedback.views import FeedbackCreate
from info.views import CampInfoView from info.views import CampInfoView
from people.views import PeopleView from people.views import PeopleView

View file

@ -1,6 +1,7 @@
from camps.models import Camp
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from camps.models import Camp
class CampViewMixin: class CampViewMixin:
""" """

View file

@ -8,6 +8,7 @@ from django.db import models
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from psycopg2.extras import DateTimeTZRange from psycopg2.extras import DateTimeTZRange
from utils.models import CreatedUpdatedModel, UUIDModel from utils.models import CreatedUpdatedModel, UUIDModel
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)

View file

@ -1,7 +1,8 @@
from camps.models import Camp
from django.contrib import admin from django.contrib import admin
from django.utils import timezone from django.utils import timezone
from camps.models import Camp
def get_current_camp(): def get_current_camp():
try: try:

View file

@ -1,6 +1,7 @@
import os import os
from django.conf import settings from django.conf import settings
from teams.models import Team from teams.models import Team
from utils.email import add_outgoing_email from utils.email import add_outgoing_email

View file

@ -53,7 +53,9 @@ class Migration(migrations.Migration):
), ),
), ),
], ],
options={"ordering": ["name"],}, options={
"ordering": ["name"],
},
), ),
migrations.CreateModel( migrations.CreateModel(
name="PosReport", name="PosReport",
@ -279,6 +281,8 @@ class Migration(migrations.Migration):
), ),
), ),
], ],
options={"abstract": False,}, options={
"abstract": False,
},
), ),
] ]

View file

@ -11,6 +11,7 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name="posreport", options={"ordering": ["date", "pos"]}, name="posreport",
options={"ordering": ["date", "pos"]},
), ),
] ]

View file

@ -4,6 +4,7 @@ from django.contrib import messages
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from utils.models import CampRelatedModel, CreatedUpdatedModel, UUIDModel from utils.models import CampRelatedModel, CreatedUpdatedModel, UUIDModel
from utils.slugs import unique_slugify from utils.slugs import unique_slugify

View file

@ -1,7 +1,6 @@
import os import os
import magic import magic
from camps.mixins import CampViewMixin
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
@ -16,6 +15,8 @@ from django.views.generic import (
TemplateView, TemplateView,
UpdateView, UpdateView,
) )
from camps.mixins import CampViewMixin
from teams.models import Team from teams.models import Team
from utils.email import add_outgoing_email from utils.email import add_outgoing_email
from utils.mixins import RaisePermissionRequiredMixin from utils.mixins import RaisePermissionRequiredMixin

View file

@ -1,4 +1,5 @@
from django.db import models from django.db import models
from teams.models import Team from teams.models import Team
from utils.models import CreatedUpdatedModel from utils.models import CreatedUpdatedModel

View file

@ -42,7 +42,9 @@ class Migration(migrations.Migration):
models.TextField(help_text="Description of this facility"), models.TextField(help_text="Description of this facility"),
), ),
], ],
options={"abstract": False,}, options={
"abstract": False,
},
), ),
migrations.CreateModel( migrations.CreateModel(
name="FacilityQuickFeedback", name="FacilityQuickFeedback",
@ -124,7 +126,9 @@ class Migration(migrations.Migration):
), ),
), ),
], ],
options={"unique_together": {("slug", "responsible_team")},}, options={
"unique_together": {("slug", "responsible_team")},
},
), ),
migrations.CreateModel( migrations.CreateModel(
name="FacilityFeedback", name="FacilityFeedback",
@ -202,7 +206,9 @@ class Migration(migrations.Migration):
), ),
), ),
], ],
options={"abstract": False,}, options={
"abstract": False,
},
), ),
migrations.AddField( migrations.AddField(
model_name="facility", model_name="facility",

View file

@ -50,6 +50,8 @@ class Migration(migrations.Migration):
), ),
), ),
], ],
options={"abstract": False,}, options={
"abstract": False,
},
), ),
] ]

View file

@ -14,7 +14,8 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterModelOptions( migrations.AlterModelOptions(
name="facilityopeninghours", options={"ordering": ["when"]}, name="facilityopeninghours",
options={"ordering": ["when"]},
), ),
migrations.AlterField( migrations.AlterField(
model_name="facility", model_name="facility",

View file

@ -1,6 +1,7 @@
from camps.mixins import CampViewMixin
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from camps.mixins import CampViewMixin
from .models import Facility, FacilityType from .models import Facility, FacilityType

View file

@ -9,6 +9,7 @@ from django.contrib.postgres.constraints import ExclusionConstraint
from django.contrib.postgres.fields import DateTimeRangeField, RangeOperators from django.contrib.postgres.fields import DateTimeRangeField, RangeOperators
from django.db import models from django.db import models
from django.shortcuts import reverse from django.shortcuts import reverse
from maps.utils import LeafletMarkerChoices from maps.utils import LeafletMarkerChoices
from utils.models import CampRelatedModel, UUIDModel from utils.models import CampRelatedModel, UUIDModel
from utils.slugs import unique_slugify from utils.slugs import unique_slugify
@ -111,7 +112,8 @@ class Facility(CampRelatedModel, UUIDModel):
) )
name = models.CharField( name = models.CharField(
max_length=100, help_text="Name or description of this facility", max_length=100,
help_text="Name or description of this facility",
) )
description = models.TextField(help_text="Description of this facility") description = models.TextField(help_text="Description of this facility")
@ -250,7 +252,8 @@ class FacilityOpeningHours(CampRelatedModel):
) )
when = DateTimeRangeField( when = DateTimeRangeField(
db_index=True, help_text="The period when this facility is open.", db_index=True,
help_text="The period when this facility is open.",
) )
notes = models.TextField( notes = models.TextField(

View file

@ -1,4 +1,3 @@
from camps.mixins import CampViewMixin
from django import forms from django import forms
from django.contrib import messages from django.contrib import messages
from django.shortcuts import redirect from django.shortcuts import redirect
@ -6,6 +5,8 @@ from django.urls import reverse
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from django.views.generic.edit import CreateView from django.views.generic.edit import CreateView
from camps.mixins import CampViewMixin
from .mixins import FacilityTypeViewMixin, FacilityViewMixin from .mixins import FacilityTypeViewMixin, FacilityViewMixin
from .models import Facility, FacilityFeedback, FacilityType from .models import Facility, FacilityFeedback, FacilityType

View file

@ -1,4 +1,5 @@
from django.db import models from django.db import models
from utils.models import CampRelatedModel, UUIDModel from utils.models import CampRelatedModel, UUIDModel

View file

@ -1,9 +1,10 @@
from camps.mixins import CampViewMixin
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.urls import reverse from django.urls import reverse
from django.views.generic import CreateView from django.views.generic import CreateView
from camps.mixins import CampViewMixin
from tokens.models import Token from tokens.models import Token
from .models import Feedback from .models import Feedback

View file

@ -1,6 +1,7 @@
import reversion import reversion
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from utils.models import CampRelatedModel from utils.models import CampRelatedModel

View file

@ -1,6 +1,7 @@
from camps.mixins import CampViewMixin
from django.views.generic import ListView from django.views.generic import ListView
from camps.mixins import CampViewMixin
from .models import InfoCategory from .models import InfoCategory

View file

@ -7,6 +7,7 @@ import irc3
from asgiref.sync import sync_to_async from asgiref.sync import sync_to_async
from django.conf import settings from django.conf import settings
from django.utils import timezone from django.utils import timezone
from ircbot.models import OutgoingIrcMessage from ircbot.models import OutgoingIrcMessage
from teams.models import Team, TeamMember from teams.models import Team, TeamMember
from teams.utils import get_team_from_irc_channel from teams.utils import get_team_from_irc_channel

View file

@ -1,6 +1,7 @@
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from utils.models import CreatedUpdatedModel from utils.models import CreatedUpdatedModel

View file

@ -1,6 +1,7 @@
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from django.utils.text import slugify from django.utils.text import slugify
from utils.models import CreatedUpdatedModel from utils.models import CreatedUpdatedModel
from utils.slugs import unique_slugify from utils.slugs import unique_slugify

View file

@ -1,6 +1,7 @@
from camps.models import Camp
from django.views.generic import ListView from django.views.generic import ListView
from camps.models import Camp
class PeopleView(ListView): class PeopleView(ListView):
template_name = "people.html" template_name = "people.html"

View file

@ -82,6 +82,8 @@ class Migration(migrations.Migration):
), ),
), ),
], ],
options={"unique_together": {("camp", "number")},}, options={
"unique_together": {("camp", "number")},
},
), ),
] ]

View file

@ -3,6 +3,7 @@ import logging
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from utils.models import CampRelatedModel from utils.models import CampRelatedModel
from .dectutils import DectUtils from .dectutils import DectUtils
@ -20,7 +21,9 @@ class DectRegistration(CampRelatedModel):
unique_together = [("camp", "number")] unique_together = [("camp", "number")]
camp = models.ForeignKey( camp = models.ForeignKey(
"camps.Camp", related_name="dect_registrations", on_delete=models.PROTECT, "camps.Camp",
related_name="dect_registrations",
on_delete=models.PROTECT,
) )
user = models.ForeignKey( user = models.ForeignKey(
@ -47,11 +50,14 @@ class DectRegistration(CampRelatedModel):
) )
activation_code = models.CharField( activation_code = models.CharField(
max_length=10, blank=True, help_text="The 10 digit numeric activation code", max_length=10,
blank=True,
help_text="The 10 digit numeric activation code",
) )
publish_in_phonebook = models.BooleanField( publish_in_phonebook = models.BooleanField(
default=True, help_text="Check to list this registration in the phonebook", default=True,
help_text="Check to list this registration in the phonebook",
) )
def save(self, *args, **kwargs): def save(self, *args, **kwargs):

View file

@ -3,7 +3,6 @@ import logging
import secrets import secrets
import string import string
from camps.mixins import CampViewMixin
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
@ -13,6 +12,8 @@ from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.views.generic import CreateView, DeleteView, ListView, UpdateView from django.views.generic import CreateView, DeleteView, ListView, UpdateView
from oauth2_provider.views.generic import ProtectedResourceView from oauth2_provider.views.generic import ProtectedResourceView
from camps.mixins import CampViewMixin
from utils.mixins import RaisePermissionRequiredMixin, UserIsObjectOwnerMixin from utils.mixins import RaisePermissionRequiredMixin, UserIsObjectOwnerMixin
from .mixins import DectRegistrationViewMixin from .mixins import DectRegistrationViewMixin

View file

@ -1,6 +1,7 @@
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from utils.models import CreatedUpdatedModel, UUIDModel from utils.models import CreatedUpdatedModel, UUIDModel

View file

@ -6,7 +6,7 @@ class ProgramConfig(AppConfig):
name = "program" name = "program"
def ready(self): def ready(self):
from .models import Speaker, EventSession from .models import EventSession, Speaker
from .signal_handlers import ( from .signal_handlers import (
check_speaker_event_camp_consistency, check_speaker_event_camp_consistency,
event_session_post_save, event_session_post_save,

View file

@ -320,7 +320,10 @@ class AutoScheduler:
This method returns a dict of Event differences and Slot differences between This method returns a dict of Event differences and Slot differences between
the two schedules. the two schedules.
""" """
slot_diff = scheduler.slot_schedule_difference(original_schedule, new_schedule,) slot_diff = scheduler.slot_schedule_difference(
original_schedule,
new_schedule,
)
slot_output = [] slot_output = []
for item in slot_diff: for item in slot_diff:
@ -347,7 +350,8 @@ class AutoScheduler:
# then get a list of differences per event # then get a list of differences per event
event_diff = scheduler.event_schedule_difference( event_diff = scheduler.event_schedule_difference(
original_schedule, new_schedule, original_schedule,
new_schedule,
) )
event_output = [] event_output = []
# loop over the differences and build the dict # loop over the differences and build the dict
@ -357,7 +361,11 @@ class AutoScheduler:
except self.camp.events.DoesNotExist: except self.camp.events.DoesNotExist:
event = item.event.name event = item.event.name
event_output.append( event_output.append(
{"event": event, "old": {}, "new": {},} {
"event": event,
"old": {},
"new": {},
}
) )
# do we have an old slot for this event? # do we have an old slot for this event?
if item.old_slot: if item.old_slot:

View file

@ -1,6 +1,7 @@
from camps.models import Camp
from channels.generic.websocket import JsonWebsocketConsumer from channels.generic.websocket import JsonWebsocketConsumer
from camps.models import Camp
from .models import ( from .models import (
Event, Event,
EventInstance, EventInstance,

View file

@ -1,6 +1,7 @@
import logging import logging
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from teams.models import Team from teams.models import Team
from utils.email import add_outgoing_email from utils.email import add_outgoing_email

View file

@ -33,7 +33,8 @@ class SpeakerProposalForm(forms.ModelForm):
# only show events from this camp # only show events from this camp
self.fields["event_conflicts"].queryset = Event.objects.filter( self.fields["event_conflicts"].queryset = Event.objects.filter(
track__camp=camp, event_type__support_speaker_event_conflicts=True, track__camp=camp,
event_type__support_speaker_event_conflicts=True,
) )
if matrix: if matrix:
@ -267,7 +268,7 @@ class EventProposalForm(forms.ModelForm):
def clean_duration(self): def clean_duration(self):
"""Make sure duration has been specified, and make sure it is not too long""" """Make sure duration has been specified, and make sure it is not too long"""
if not self.cleaned_data["duration"]: if not self.cleaned_data["duration"]:
raise forms.ValidationError(f"Please specify a duration.") raise forms.ValidationError("Please specify a duration.")
if ( if (
self.event_type.event_duration_minutes self.event_type.event_duration_minutes
and self.cleaned_data["duration"] > self.event_type.event_duration_minutes and self.cleaned_data["duration"] > self.event_type.event_duration_minutes

View file

@ -2,10 +2,11 @@ import logging
from datetime import timedelta from datetime import timedelta
from time import sleep from time import sleep
from camps.utils import get_current_camp
from django.conf import settings from django.conf import settings
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils import timezone from django.utils import timezone
from camps.utils import get_current_camp
from ircbot.models import OutgoingIrcMessage from ircbot.models import OutgoingIrcMessage
from program.models import EventInstance from program.models import EventInstance

View file

@ -2,9 +2,10 @@
# Generated by Django 1.10.5 on 2017-02-18 11:43 # Generated by Django 1.10.5 on 2017-02-18 11:43
from __future__ import unicode_literals from __future__ import unicode_literals
import program.models
from django.db import migrations, models from django.db import migrations, models
import program.models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -5,10 +5,11 @@ from __future__ import unicode_literals
import uuid import uuid
import django.db.models.deletion import django.db.models.deletion
import program.models
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
import program.models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -5,10 +5,11 @@ from __future__ import unicode_literals
import uuid import uuid
import django.db.models.deletion import django.db.models.deletion
import program.models
from django.conf import settings from django.conf import settings
from django.db import migrations, models from django.db import migrations, models
import program.models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -2,9 +2,10 @@
# Generated by Django 1.10.5 on 2017-03-14 19:12 # Generated by Django 1.10.5 on 2017-03-14 19:12
from __future__ import unicode_literals from __future__ import unicode_literals
import program.models
from django.db import migrations, models from django.db import migrations, models
import program.models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -2,9 +2,10 @@
# Generated by Django 1.10.5 on 2017-03-15 23:04 # Generated by Django 1.10.5 on 2017-03-15 23:04
from __future__ import unicode_literals from __future__ import unicode_literals
import program.models
from django.db import migrations, models from django.db import migrations, models
import program.models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -29,6 +29,7 @@ class Migration(migrations.Migration):
), ),
), ),
migrations.AlterUniqueTogether( migrations.AlterUniqueTogether(
name="eventfeedback", unique_together={("user", "event")}, name="eventfeedback",
unique_together={("user", "event")},
), ),
] ]

View file

@ -11,6 +11,8 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RenameField( migrations.RenameField(
model_name="eventfeedback", old_name="feedback", new_name="comment", model_name="eventfeedback",
old_name="feedback",
new_name="comment",
), ),
] ]

View file

@ -51,7 +51,9 @@ class Migration(migrations.Migration):
), ),
), ),
], ],
options={"ordering": ["when", "event_type", "event_location"],}, options={
"ordering": ["when", "event_type", "event_location"],
},
), ),
migrations.CreateModel( migrations.CreateModel(
name="EventSlot", name="EventSlot",
@ -81,7 +83,9 @@ class Migration(migrations.Migration):
), ),
), ),
], ],
options={"ordering": ["when"],}, options={
"ordering": ["when"],
},
), ),
migrations.CreateModel( migrations.CreateModel(
name="SpeakerAvailability", name="SpeakerAvailability",
@ -128,7 +132,9 @@ class Migration(migrations.Migration):
("created", models.DateTimeField(auto_now_add=True)), ("created", models.DateTimeField(auto_now_add=True)),
("updated", models.DateTimeField(auto_now=True)), ("updated", models.DateTimeField(auto_now=True)),
], ],
options={"abstract": False,}, options={
"abstract": False,
},
), ),
migrations.CreateModel( migrations.CreateModel(
name="SpeakerProposalAvailability", name="SpeakerProposalAvailability",
@ -175,7 +181,9 @@ class Migration(migrations.Migration):
("created", models.DateTimeField(auto_now_add=True)), ("created", models.DateTimeField(auto_now_add=True)),
("updated", models.DateTimeField(auto_now=True)), ("updated", models.DateTimeField(auto_now=True)),
], ],
options={"abstract": False,}, options={
"abstract": False,
},
), ),
migrations.AddField( migrations.AddField(
model_name="event", model_name="event",

View file

@ -32,13 +32,19 @@ class Migration(migrations.Migration):
new_name="speaker_proposal", new_name="speaker_proposal",
), ),
migrations.RenameField( migrations.RenameField(
model_name="url", old_name="eventproposal", new_name="event_proposal", model_name="url",
old_name="eventproposal",
new_name="event_proposal",
), ),
migrations.RenameField( migrations.RenameField(
model_name="url", old_name="speakerproposal", new_name="speaker_proposal", model_name="url",
old_name="speakerproposal",
new_name="speaker_proposal",
), ),
migrations.RenameField( migrations.RenameField(
model_name="url", old_name="urltype", new_name="url_type", model_name="url",
old_name="urltype",
new_name="url_type",
), ),
migrations.AlterField( migrations.AlterField(
model_name="event", model_name="event",

View file

@ -2,9 +2,10 @@
import django.contrib.postgres.constraints import django.contrib.postgres.constraints
import django.db.models.deletion import django.db.models.deletion
import utils.database
from django.db import migrations, models from django.db import migrations, models
import utils.database
class Migration(migrations.Migration): class Migration(migrations.Migration):
@ -13,13 +14,21 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RemoveField(model_name="speakereventconflict", name="events",),
migrations.RemoveField(model_name="speakereventconflict", name="speaker",),
migrations.RemoveField( migrations.RemoveField(
model_name="speakerproposaleventconflict", name="events", model_name="speakereventconflict",
name="events",
), ),
migrations.RemoveField( migrations.RemoveField(
model_name="speakerproposaleventconflict", name="speaker_proposal", model_name="speakereventconflict",
name="speaker",
),
migrations.RemoveField(
model_name="speakerproposaleventconflict",
name="events",
),
migrations.RemoveField(
model_name="speakerproposaleventconflict",
name="speaker_proposal",
), ),
migrations.AddField( migrations.AddField(
model_name="eventtype", model_name="eventtype",
@ -110,6 +119,10 @@ class Migration(migrations.Migration):
name="prevent_speaker_proposal_availability_adjacent_mergeable", name="prevent_speaker_proposal_availability_adjacent_mergeable",
), ),
), ),
migrations.DeleteModel(name="SpeakerEventConflict",), migrations.DeleteModel(
migrations.DeleteModel(name="SpeakerProposalEventConflict",), name="SpeakerEventConflict",
),
migrations.DeleteModel(
name="SpeakerProposalEventConflict",
),
] ]

View file

@ -1,9 +1,10 @@
from camps.mixins import CampViewMixin
from django.contrib import messages from django.contrib import messages
from django.http import Http404 from django.http import Http404
from django.shortcuts import get_object_or_404, redirect from django.shortcuts import get_object_or_404, redirect
from django.urls import reverse from django.urls import reverse
from django.views.generic.detail import SingleObjectMixin from django.views.generic.detail import SingleObjectMixin
from camps.mixins import CampViewMixin
from program.utils import ( from program.utils import (
add_existing_availability_to_matrix, add_existing_availability_to_matrix,
get_speaker_availability_form_matrix, get_speaker_availability_form_matrix,
@ -141,7 +142,9 @@ class EventFeedbackViewMixin(EventViewMixin):
def setup(self, *args, **kwargs): def setup(self, *args, **kwargs):
super().setup(*args, **kwargs) super().setup(*args, **kwargs)
self.event_feedback = get_object_or_404( self.event_feedback = get_object_or_404(
models.EventFeedback, event=self.event, user=self.request.user, models.EventFeedback,
event=self.event,
user=self.request.user,
) )
def get_object(self): def get_object(self):

View file

@ -18,6 +18,7 @@ from django.utils import timezone
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from psycopg2.extras import DateTimeTZRange from psycopg2.extras import DateTimeTZRange
from taggit.managers import TaggableManager from taggit.managers import TaggableManager
from utils.database import CastToInteger from utils.database import CastToInteger
from utils.models import ( from utils.models import (
CampRelatedModel, CampRelatedModel,
@ -290,7 +291,9 @@ class SpeakerAvailability(Availability):
def clean(self): def clean(self):
# this should be an ExclusionConstraint but the boolean condition isn't conditioning :/ # this should be an ExclusionConstraint but the boolean condition isn't conditioning :/
if SpeakerAvailability.objects.filter( if SpeakerAvailability.objects.filter(
speaker=self.speaker, when__adjacent_to=self.when, available=self.available, speaker=self.speaker,
when__adjacent_to=self.when,
available=self.available,
).exists(): ).exists():
raise ValidationError( raise ValidationError(
"An adjacent SpeakerAvailability object for this Speaker already exists with the same value for available, cannot save()" "An adjacent SpeakerAvailability object for this Speaker already exists with the same value for available, cannot save()"
@ -538,7 +541,10 @@ class EventProposal(UserSubmittedModel):
help_text="Will you be using the provided speaker laptop?", default=True help_text="Will you be using the provided speaker laptop?", default=True
) )
tags = TaggableManager(through=UUIDTaggedItem, blank=True,) tags = TaggableManager(
through=UUIDTaggedItem,
blank=True,
)
@property @property
def camp(self): def camp(self):
@ -785,7 +791,8 @@ class EventType(CreatedUpdatedModel):
) )
support_autoscheduling = models.BooleanField( support_autoscheduling = models.BooleanField(
default=False, help_text="Check to enable this EventType in the autoscheduler", default=False,
help_text="Check to enable this EventType in the autoscheduler",
) )
support_speaker_event_conflicts = models.BooleanField( support_speaker_event_conflicts = models.BooleanField(
@ -891,7 +898,8 @@ class EventSession(CampRelatedModel):
) )
description = models.TextField( description = models.TextField(
blank=True, help_text="Description of this session (optional).", blank=True,
help_text="Description of this session (optional).",
) )
def __str__(self): def __str__(self):
@ -957,7 +965,8 @@ class EventSession(CampRelatedModel):
"""Return a list of slots that are not available for some reason""" """Return a list of slots that are not available for some reason"""
return self.event_slots.exclude( return self.event_slots.exclude(
id__in=self.get_available_slots( id__in=self.get_available_slots(
count_autoscheduled_as_free=count_autoscheduled_as_free, bounds=bounds, count_autoscheduled_as_free=count_autoscheduled_as_free,
bounds=bounds,
).values_list("id", flat=True), ).values_list("id", flat=True),
) )
@ -1036,7 +1045,9 @@ class EventSlot(CampRelatedModel):
help_text="The EventSession this EventSlot belongs to", help_text="The EventSession this EventSlot belongs to",
) )
when = DateTimeRangeField(help_text="Start and end time of this slot",) when = DateTimeRangeField(
help_text="Start and end time of this slot",
)
event = models.ForeignKey( event = models.ForeignKey(
"program.Event", "program.Event",
@ -1362,7 +1373,8 @@ class EventInstance(CampRelatedModel):
) )
autoscheduled = models.BooleanField( autoscheduled = models.BooleanField(
default=False, help_text="True if this was created by the autoscheduler.", default=False,
help_text="True if this was created by the autoscheduler.",
) )
class Meta: class Meta:
@ -1638,7 +1650,8 @@ class EventFeedback(CampRelatedModel, UUIDModel):
) )
expectations_fulfilled = models.BooleanField( expectations_fulfilled = models.BooleanField(
choices=YESNO_CHOICES, help_text="Did the event live up to your expectations?", choices=YESNO_CHOICES,
help_text="Did the event live up to your expectations?",
) )
attend_speaker_again = models.BooleanField( attend_speaker_again = models.BooleanField(
@ -1649,7 +1662,8 @@ class EventFeedback(CampRelatedModel, UUIDModel):
RATING_CHOICES = [(n, f"{n}") for n in range(0, 6)] RATING_CHOICES = [(n, f"{n}") for n in range(0, 6)]
rating = models.IntegerField( rating = models.IntegerField(
choices=RATING_CHOICES, help_text="Rating/Score (5 is best)", choices=RATING_CHOICES,
help_text="Rating/Score (5 is best)",
) )
comment = models.TextField(blank=True, help_text="Any other comments or feedback?") comment = models.TextField(blank=True, help_text="Any other comments or feedback?")
@ -1682,15 +1696,12 @@ class CustomUrlStorage(FileSystemStorage):
Can be removed when we clean up old migrations at some point Can be removed when we clean up old migrations at some point
""" """
pass
def get_speaker_picture_upload_path(): def get_speaker_picture_upload_path():
""" """
Must exist because it is mentioned in old migrations. Must exist because it is mentioned in old migrations.
Can be removed when we clean up old migrations at some point Can be removed when we clean up old migrations at some point
""" """
pass
def get_speakerproposal_picture_upload_path(): def get_speakerproposal_picture_upload_path():
@ -1698,7 +1709,6 @@ def get_speakerproposal_picture_upload_path():
Must exist because it is mentioned in old migrations. Must exist because it is mentioned in old migrations.
Can be removed when we clean up old migrations at some point Can be removed when we clean up old migrations at some point
""" """
pass
def get_speakersubmission_picture_upload_path(): def get_speakersubmission_picture_upload_path():
@ -1706,4 +1716,3 @@ def get_speakersubmission_picture_upload_path():
Must exist because it is mentioned in old migrations. Must exist because it is mentioned in old migrations.
Can be removed when we clean up old migrations at some point Can be removed when we clean up old migrations at some point
""" """
pass

View file

@ -50,7 +50,8 @@ class MultiForm(object):
# Some things, such as the WizardView expect these to exist. # Some things, such as the WizardView expect these to exist.
self.data, self.files = data, files self.data, self.files = data, files
kwargs.update( kwargs.update(
data=data, files=files, data=data,
files=files,
) )
self.initials = kwargs.pop("initial", None) self.initials = kwargs.pop("initial", None)
@ -74,7 +75,8 @@ class MultiForm(object):
else: else:
prefix = "{0}__{1}".format(key, prefix) prefix = "{0}__{1}".format(key, prefix)
fkwargs.update( fkwargs.update(
initial=self.initials.get(key), prefix=prefix, initial=self.initials.get(key),
prefix=prefix,
) )
return args, fkwargs return args, fkwargs

View file

@ -7,7 +7,7 @@ logger = logging.getLogger("bornhack.%s" % __name__)
def check_speaker_event_camp_consistency(sender, instance, **kwargs): def check_speaker_event_camp_consistency(sender, instance, **kwargs):
if kwargs["action"] == "pre_add": if kwargs["action"] == "pre_add":
from program.models import Speaker, Event from program.models import Event, Speaker
if isinstance(instance, Event): if isinstance(instance, Event):
# loop over speakers being added to this event # loop over speakers being added to this event

View file

@ -32,7 +32,7 @@ def availabilitytable(matrix, form=None):
# start bulding the output # start bulding the output
output = "<div class='form-group'>" output = "<div class='form-group'>"
output += "<table class='table table-hover table-condensed table-bordered table-responsive' style='margin-bottom: .25em;'><thead>" output += "<table class='table table-hover table-condensed table-bordered table-responsive' style='margin-bottom: .25em;'><thead>"
output += f"<tr><th class='text-nowrap'>Speaker Availability</th>" output += "<tr><th class='text-nowrap'>Speaker Availability</th>"
# to build the <thead> for this table we need to loop over the days (dates) # to build the <thead> for this table we need to loop over the days (dates)
# in the matrix and create a column for each # in the matrix and create a column for each

View file

@ -93,7 +93,11 @@ def get_speaker_availability_form_matrix(sessions):
# pass a list of dicts instead of the queryset to avoid one million lookups # pass a list of dicts instead of the queryset to avoid one million lookups
for et in event_types: for et in event_types:
matrix[day][daychunk]["event_types"].append( matrix[day][daychunk]["event_types"].append(
{"name": et.name, "icon": et.icon, "color": et.color,} {
"name": et.name,
"icon": et.icon,
"color": et.color,
}
) )
matrix[day][daychunk]["initial"] = None matrix[day][daychunk]["initial"] = None
else: else:
@ -205,7 +209,9 @@ def save_speaker_availability(form, obj):
else: else:
# "available" changed or daychunk is not adjacent to formerchunk # "available" changed or daychunk is not adjacent to formerchunk
AvailabilityModel.objects.create( AvailabilityModel.objects.create(
when=formerchunk, available=formeravailable, **kwargs, when=formerchunk,
available=formeravailable,
**kwargs,
) )
# and remember the current chunk for next iteration # and remember the current chunk for next iteration
formerchunk = daychunk formerchunk = daychunk

View file

@ -2,7 +2,6 @@ import logging
from collections import OrderedDict from collections import OrderedDict
import icalendar import icalendar
from camps.mixins import CampViewMixin
from django import forms from django import forms
from django.contrib import messages from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required from django.contrib.admin.views.decorators import staff_member_required
@ -15,6 +14,8 @@ from django.utils.decorators import method_decorator
from django.views.generic import DetailView, ListView, TemplateView, View from django.views.generic import DetailView, ListView, TemplateView, View
from django.views.generic.edit import CreateView, DeleteView, UpdateView from django.views.generic.edit import CreateView, DeleteView, UpdateView
from lxml import etree, objectify from lxml import etree, objectify
from camps.mixins import CampViewMixin
from utils.middleware import RedirectException from utils.middleware import RedirectException
from utils.mixins import UserIsObjectOwnerMixin from utils.mixins import UserIsObjectOwnerMixin
@ -82,7 +83,8 @@ class ICSView(CampViewMixin, View):
query_kwargs["event__video_recording"] = False query_kwargs["event__video_recording"] = False
event_slots = models.EventSlot.objects.filter( event_slots = models.EventSlot.objects.filter(
event__track__camp=self.camp, **query_kwargs, event__track__camp=self.camp,
**query_kwargs,
).prefetch_related("event", "event_session__event_location") ).prefetch_related("event", "event_session__event_location")
cal = icalendar.Calendar() cal = icalendar.Calendar()
@ -295,7 +297,7 @@ class SpeakerProposalUpdateView(
# message user and redirect # message user and redirect
messages.info( messages.info(
self.request, self.request,
f"Changes to your proposal is now pending approval by the content team.", "Changes to your proposal is now pending approval by the content team.",
) )
return redirect( return redirect(
reverse( reverse(
@ -1004,7 +1006,9 @@ class FrabXmlView(CampViewMixin, View):
qs = ( qs = (
models.EventSlot.objects.filter(event__track__camp=self.camp) models.EventSlot.objects.filter(event__track__camp=self.camp)
.prefetch_related( .prefetch_related(
"event__urls", "event__speakers", "event_session__event_location", "event__urls",
"event__speakers",
"event_session__event_location",
) )
.order_by("when", "event_session__event_location") .order_by("when", "event_session__event_location")
) )

View file

@ -11,6 +11,8 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.RenameField( migrations.RenameField(
model_name="ride", old_name="location", new_name="from_location", model_name="ride",
old_name="location",
new_name="from_location",
), ),
] ]

View file

@ -1,5 +1,6 @@
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
from utils.models import CampRelatedModel, UUIDModel from utils.models import CampRelatedModel, UUIDModel

View file

@ -1,4 +1,3 @@
from camps.mixins import CampViewMixin
from django import forms from django import forms
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
@ -11,6 +10,8 @@ from django.views.generic import (
ListView, ListView,
UpdateView, UpdateView,
) )
from camps.mixins import CampViewMixin
from teams.models import Team from teams.models import Team
from utils.email import add_outgoing_email from utils.email import add_outgoing_email
from utils.mixins import UserIsObjectOwnerMixin from utils.mixins import UserIsObjectOwnerMixin

View file

@ -1,4 +1,5 @@
from django.contrib import admin from django.contrib import admin
from tickets.admin import ShopTicketInline from tickets.admin import ShopTicketInline
from .models import ( from .models import (

View file

@ -3,6 +3,7 @@ import logging
import requests import requests
from django.conf import settings from django.conf import settings
from vendor.coinify.coinify_api import CoinifyAPI from vendor.coinify.coinify_api import CoinifyAPI
from .models import CoinifyAPICallback, CoinifyAPIInvoice, CoinifyAPIRequest from .models import CoinifyAPICallback, CoinifyAPIInvoice, CoinifyAPIRequest

View file

@ -2,6 +2,7 @@ import factory
from django.utils import timezone from django.utils import timezone
from factory.django import DjangoModelFactory from factory.django import DjangoModelFactory
from psycopg2.extras import DateTimeTZRange from psycopg2.extras import DateTimeTZRange
from utils.factories import UserFactory from utils.factories import UserFactory

View file

@ -1,5 +1,6 @@
from django import forms from django import forms
from django.forms import modelformset_factory from django.forms import modelformset_factory
from shop.models import OrderProductRelation from shop.models import OrderProductRelation

View file

@ -3,6 +3,7 @@ import logging
from django.conf import settings from django.conf import settings
from django.core.files import File from django.core.files import File
from django.db.models import Q from django.db.models import Q
from shop.email import add_creditnote_email, add_invoice_email from shop.email import add_creditnote_email, add_invoice_email
from shop.models import CreditNote, CustomOrder, Invoice, Order from shop.models import CreditNote, CustomOrder, Invoice, Order
from utils.pdf import generate_pdf_letter from utils.pdf import generate_pdf_letter

View file

@ -11,7 +11,9 @@ class Migration(migrations.Migration):
operations = [ operations = [
migrations.AlterField( migrations.AlterField(
model_name="coinifyapicallback", name="headers", field=models.JSONField(), model_name="coinifyapicallback",
name="headers",
field=models.JSONField(),
), ),
migrations.AlterField( migrations.AlterField(
model_name="coinifyapicallback", model_name="coinifyapicallback",
@ -24,13 +26,19 @@ class Migration(migrations.Migration):
field=models.JSONField(), field=models.JSONField(),
), ),
migrations.AlterField( migrations.AlterField(
model_name="coinifyapirequest", name="payload", field=models.JSONField(), model_name="coinifyapirequest",
name="payload",
field=models.JSONField(),
), ),
migrations.AlterField( migrations.AlterField(
model_name="coinifyapirequest", name="response", field=models.JSONField(), model_name="coinifyapirequest",
name="response",
field=models.JSONField(),
), ),
migrations.AlterField( migrations.AlterField(
model_name="epaycallback", name="payload", field=models.JSONField(), model_name="epaycallback",
name="payload",
field=models.JSONField(),
), ),
migrations.AlterField( migrations.AlterField(
model_name="order", model_name="order",

View file

@ -13,6 +13,7 @@ from django.utils import timezone
from django.utils.dateparse import parse_datetime from django.utils.dateparse import parse_datetime
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from unidecode import unidecode from unidecode import unidecode
from utils.models import CreatedUpdatedModel, UUIDModel from utils.models import CreatedUpdatedModel, UUIDModel
from utils.slugs import unique_slugify from utils.slugs import unique_slugify

View file

@ -2,6 +2,7 @@ from django.test import TestCase
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from psycopg2.extras import DateTimeTZRange from psycopg2.extras import DateTimeTZRange
from shop.forms import OrderProductRelationForm from shop.forms import OrderProductRelationForm
from tickets.factories import TicketTypeFactory from tickets.factories import TicketTypeFactory
from tickets.models import ShopTicket from tickets.models import ShopTicket

View file

@ -19,6 +19,7 @@ from django.views.decorators.csrf import csrf_exempt
from django.views.generic import DetailView, FormView, ListView, View from django.views.generic import DetailView, FormView, ListView, View
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from django.views.generic.detail import SingleObjectMixin from django.views.generic.detail import SingleObjectMixin
from shop.models import ( from shop.models import (
CreditNote, CreditNote,
EpayCallback, EpayCallback,

View file

@ -2,6 +2,7 @@ import logging
import os import os
from django.conf import settings from django.conf import settings
from teams.models import Team from teams.models import Team
from utils.email import add_outgoing_email from utils.email import add_outgoing_email

View file

@ -1,9 +1,10 @@
# coding: utf-8 # coding: utf-8
import logging import logging
from camps.models import Camp
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils import timezone from django.utils import timezone
from camps.models import Camp
from sponsors.email import add_sponsorticket_email from sponsors.email import add_sponsorticket_email
from sponsors.models import Sponsor from sponsors.models import Sponsor

View file

@ -1,7 +1,8 @@
# coding: utf-8 # coding: utf-8
from camps.models import Camp
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.utils import timezone from django.utils import timezone
from camps.models import Camp
from sponsors.models import Sponsor from sponsors.models import Sponsor
from tickets.models import SponsorTicket, TicketType from tickets.models import SponsorTicket, TicketType

View file

@ -2,9 +2,10 @@
# Generated by Django 1.11 on 2017-07-11 21:35 # Generated by Django 1.11 on 2017-07-11 21:35
from __future__ import unicode_literals from __future__ import unicode_literals
import sponsors.models
from django.db import migrations, models from django.db import migrations, models
import sponsors.models
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -1,4 +1,5 @@
from django.db import models from django.db import models
from utils.models import CampRelatedModel from utils.models import CampRelatedModel

View file

@ -1,6 +1,7 @@
from camps.mixins import CampViewMixin
from django.views.generic import ListView from django.views.generic import ListView
from camps.mixins import CampViewMixin
from .models import Sponsor from .models import Sponsor

View file

@ -1,6 +1,7 @@
from camps.utils import CampPropertyListFilter
from django.contrib import admin from django.contrib import admin
from camps.utils import CampPropertyListFilter
from .email import add_added_membership_email, add_removed_membership_email from .email import add_added_membership_email, add_removed_membership_email
from .models import Team, TeamMember, TeamShift, TeamTask from .models import Team, TeamMember, TeamShift, TeamTask

View file

@ -5,6 +5,7 @@ from django.contrib.postgres.fields import DateTimeRangeField
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
from django.db import models from django.db import models
from django.urls import reverse_lazy from django.urls import reverse_lazy
from utils.models import CampRelatedModel, CreatedUpdatedModel, UUIDModel from utils.models import CampRelatedModel, CreatedUpdatedModel, UUIDModel
from utils.slugs import unique_slugify from utils.slugs import unique_slugify

View file

@ -1,6 +1,5 @@
import logging import logging
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)
@ -13,6 +12,7 @@ def teammember_saved(sender, instance, created, **kwargs):
# call the mail sending function # call the mail sending function
# late import to please django 3.2 or "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet." # late import to please django 3.2 or "django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet."
from .email import add_new_membership_email from .email import add_new_membership_email
if not add_new_membership_email(instance): if not add_new_membership_email(instance):
logger.error("Error adding email to outgoing queue") logger.error("Error adding email to outgoing queue")

View file

@ -1,5 +1,6 @@
from django import template from django import template
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from teams.models import TeamMember from teams.models import TeamMember
register = template.Library() register = template.Library()

View file

@ -1,4 +1,5 @@
from django.urls import include, path from django.urls import include, path
from teams.views.base import ( from teams.views.base import (
FixIrcAclView, FixIrcAclView,
TeamGeneralView, TeamGeneralView,

View file

@ -1,6 +1,5 @@
import logging import logging
from camps.mixins import CampViewMixin
from django.conf import settings from django.conf import settings
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
@ -9,6 +8,8 @@ from django.urls import reverse_lazy
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from django.views.generic.edit import UpdateView from django.views.generic.edit import UpdateView
from camps.mixins import CampViewMixin
from ..models import Team, TeamMember from ..models import Team, TeamMember
from .mixins import EnsureTeamResponsibleMixin from .mixins import EnsureTeamResponsibleMixin

View file

@ -1,7 +1,8 @@
from camps.mixins import CampViewMixin
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.views.generic import DetailView from django.views.generic import DetailView
from camps.mixins import CampViewMixin
from ..models import Team, TeamMember from ..models import Team, TeamMember

View file

@ -1,10 +1,11 @@
from camps.mixins import CampViewMixin
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.views.generic import CreateView, DeleteView, ListView, UpdateView from django.views.generic import CreateView, DeleteView, ListView, UpdateView
from info.models import InfoCategory, InfoItem
from reversion.views import RevisionMixin from reversion.views import RevisionMixin
from camps.mixins import CampViewMixin
from info.models import InfoCategory, InfoItem
from ..models import Team from ..models import Team
from .mixins import EnsureTeamResponsibleMixin, TeamViewMixin from .mixins import EnsureTeamResponsibleMixin, TeamViewMixin

View file

@ -1,10 +1,11 @@
import logging import logging
from camps.mixins import CampViewMixin
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.shortcuts import redirect from django.shortcuts import redirect
from django.views.generic import DetailView, UpdateView from django.views.generic import DetailView, UpdateView
from camps.mixins import CampViewMixin
from profiles.models import Profile from profiles.models import Profile
from ..email import add_added_membership_email, add_removed_membership_email from ..email import add_added_membership_email, add_removed_membership_email

View file

@ -1,6 +1,7 @@
from django.contrib import messages from django.contrib import messages
from django.shortcuts import redirect from django.shortcuts import redirect
from django.views.generic.detail import SingleObjectMixin from django.views.generic.detail import SingleObjectMixin
from teams.models import Team, TeamMember from teams.models import Team, TeamMember

View file

@ -1,4 +1,3 @@
from camps.mixins import CampViewMixin
from django import forms from django import forms
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
@ -17,6 +16,8 @@ from django.views.generic import (
) )
from psycopg2.extras import DateTimeTZRange from psycopg2.extras import DateTimeTZRange
from camps.mixins import CampViewMixin
from ..models import Team, TeamMember, TeamShift from ..models import Team, TeamMember, TeamShift

View file

@ -1,10 +1,11 @@
from camps.mixins import CampViewMixin
from django import forms from django import forms
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseNotAllowed, HttpResponseRedirect from django.http import HttpResponseNotAllowed, HttpResponseRedirect
from django.views.generic import CreateView, DetailView, UpdateView from django.views.generic import CreateView, DetailView, UpdateView
from camps.mixins import CampViewMixin
from ..models import TaskComment, Team, TeamMember, TeamTask from ..models import TaskComment, Team, TeamMember, TeamTask
from .mixins import EnsureTeamResponsibleMixin, TeamViewMixin from .mixins import EnsureTeamResponsibleMixin, TeamViewMixin

View file

@ -1,4 +1,5 @@
from django.contrib import admin from django.contrib import admin
from shop.models import OrderProductRelation from shop.models import OrderProductRelation
from .models import DiscountTicket, ShopTicket, SponsorTicket, TicketType from .models import DiscountTicket, ShopTicket, SponsorTicket, TicketType

View file

@ -1,6 +1,7 @@
# Generated by Django 2.2.2 on 2019-07-18 18:52 # Generated by Django 2.2.2 on 2019-07-18 18:52
from django.conf import settings from django.conf import settings
from django.db import migrations from django.db import migrations
from tickets.models import create_ticket_token from tickets.models import create_ticket_token

Some files were not shown because too many files have changed in this diff Show more