misc: apply double-quote-string-fixer (#79788)
This commit is contained in:
parent
71ac1e739b
commit
d6cba77e3f
|
@ -110,7 +110,7 @@ class CampaignForm(forms.ModelForm):
|
||||||
Campaign.objects.filter(regie=self.instance.regie)
|
Campaign.objects.filter(regie=self.instance.regie)
|
||||||
.exclude(pk=self.instance.pk)
|
.exclude(pk=self.instance.pk)
|
||||||
.extra(
|
.extra(
|
||||||
where=["(date_start, date_end) OVERLAPS (%s, %s)"],
|
where=['(date_start, date_end) OVERLAPS (%s, %s)'],
|
||||||
params=[new_date_start, new_date_end],
|
params=[new_date_start, new_date_end],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -40,7 +40,7 @@ def get_agendas(pool):
|
||||||
agendas_pricings = AgendaPricing.objects.filter(
|
agendas_pricings = AgendaPricing.objects.filter(
|
||||||
flat_fee_schedule=False, agendas__regie=pool.campaign.regie, agendas__in=pool.campaign.agendas.all()
|
flat_fee_schedule=False, agendas__regie=pool.campaign.regie, agendas__in=pool.campaign.agendas.all()
|
||||||
).extra(
|
).extra(
|
||||||
where=["(date_start, date_end) OVERLAPS (%s, %s)"],
|
where=['(date_start, date_end) OVERLAPS (%s, %s)'],
|
||||||
params=[pool.campaign.date_start, pool.campaign.date_end],
|
params=[pool.campaign.date_start, pool.campaign.date_end],
|
||||||
)
|
)
|
||||||
return Agenda.objects.filter(pk__in=agendas_pricings.values('agendas')).order_by('pk')
|
return Agenda.objects.filter(pk__in=agendas_pricings.values('agendas')).order_by('pk')
|
||||||
|
@ -263,7 +263,7 @@ def get_all_invoice_lines(agendas, users, pool):
|
||||||
agendas_pricings = (
|
agendas_pricings = (
|
||||||
AgendaPricing.objects.filter(flat_fee_schedule=False)
|
AgendaPricing.objects.filter(flat_fee_schedule=False)
|
||||||
.extra(
|
.extra(
|
||||||
where=["(date_start, date_end) OVERLAPS (%s, %s)"],
|
where=['(date_start, date_end) OVERLAPS (%s, %s)'],
|
||||||
params=[pool.campaign.date_start, pool.campaign.date_end],
|
params=[pool.campaign.date_start, pool.campaign.date_end],
|
||||||
)
|
)
|
||||||
.prefetch_related('agendas', 'pricing__criterias', 'pricing__categories')
|
.prefetch_related('agendas', 'pricing__criterias', 'pricing__categories')
|
||||||
|
|
|
@ -116,7 +116,7 @@ class ConfigImportView(FormView):
|
||||||
message2 = import_messages[obj_name]['update'](count) % {'count': count}
|
message2 = import_messages[obj_name]['update'](count) % {'count': count}
|
||||||
|
|
||||||
if message1:
|
if message1:
|
||||||
obj_results['messages'] = "%s %s" % (message1, message2)
|
obj_results['messages'] = '%s %s' % (message1, message2)
|
||||||
else:
|
else:
|
||||||
obj_results['messages'] = message2
|
obj_results['messages'] = message2
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ class AgendaPricingForm(NewAgendaPricingForm):
|
||||||
AgendaPricing.objects.filter(flat_fee_schedule=new_flat_fee_schedule)
|
AgendaPricing.objects.filter(flat_fee_schedule=new_flat_fee_schedule)
|
||||||
.exclude(pk=self.instance.pk)
|
.exclude(pk=self.instance.pk)
|
||||||
.extra(
|
.extra(
|
||||||
where=["(date_start, date_end) OVERLAPS (%s, %s)"],
|
where=['(date_start, date_end) OVERLAPS (%s, %s)'],
|
||||||
params=[new_date_start, new_date_end],
|
params=[new_date_start, new_date_end],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -255,7 +255,7 @@ class AgendaPricingAgendaAddForm(forms.Form):
|
||||||
overlapping_qs = AgendaPricing.objects.filter(
|
overlapping_qs = AgendaPricing.objects.filter(
|
||||||
flat_fee_schedule=self.agenda_pricing.flat_fee_schedule, agendas=agenda
|
flat_fee_schedule=self.agenda_pricing.flat_fee_schedule, agendas=agenda
|
||||||
).extra(
|
).extra(
|
||||||
where=["(date_start, date_end) OVERLAPS (%s, %s)"],
|
where=['(date_start, date_end) OVERLAPS (%s, %s)'],
|
||||||
params=[self.agenda_pricing.date_start, self.agenda_pricing.date_end],
|
params=[self.agenda_pricing.date_start, self.agenda_pricing.date_end],
|
||||||
)
|
)
|
||||||
if overlapping_qs.exists():
|
if overlapping_qs.exists():
|
||||||
|
|
|
@ -194,7 +194,7 @@ class ConfigImportView(FormView):
|
||||||
message2 = import_messages[obj_name]['update'](count) % {'count': count}
|
message2 = import_messages[obj_name]['update'](count) % {'count': count}
|
||||||
|
|
||||||
if message1:
|
if message1:
|
||||||
obj_results['messages'] = "%s %s" % (message1, message2)
|
obj_results['messages'] = '%s %s' % (message1, message2)
|
||||||
else:
|
else:
|
||||||
obj_results['messages'] = message2
|
obj_results['messages'] = message2
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ class AgendaBookingCheckSettingsView(AgendaMixin, UpdateView):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['form_url'] = reverse('lingo-manager-agenda-booking-check-settings', args=[self.agenda.pk])
|
context['form_url'] = reverse('lingo-manager-agenda-booking-check-settings', args=[self.agenda.pk])
|
||||||
context['title'] = _("Configure booking check options")
|
context['title'] = _('Configure booking check options')
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ class AgendaInvoicingSettingsView(AgendaMixin, UpdateView):
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['form_url'] = reverse('lingo-manager-agenda-invoicing-settings', args=[self.agenda.pk])
|
context['form_url'] = reverse('lingo-manager-agenda-invoicing-settings', args=[self.agenda.pk])
|
||||||
context['title'] = _("Configure invoicing options")
|
context['title'] = _('Configure invoicing options')
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,6 @@ import os
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lingo.settings")
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lingo.settings')
|
||||||
|
|
||||||
application = get_wsgi_application()
|
application = get_wsgi_application()
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == '__main__':
|
||||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lingo.settings")
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'lingo.settings')
|
||||||
|
|
||||||
from django.core.management import execute_from_command_line
|
from django.core.management import execute_from_command_line
|
||||||
|
|
||||||
|
|
|
@ -25,32 +25,32 @@ pytestmark = pytest.mark.django_db
|
||||||
|
|
||||||
AGENDA_DATA = [
|
AGENDA_DATA = [
|
||||||
{
|
{
|
||||||
"slug": "events-a",
|
'slug': 'events-a',
|
||||||
"kind": "events",
|
'kind': 'events',
|
||||||
"text": "Events A",
|
'text': 'Events A',
|
||||||
"category": None,
|
'category': None,
|
||||||
"category_label": None,
|
'category_label': None,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"slug": "events-b",
|
'slug': 'events-b',
|
||||||
"kind": "events",
|
'kind': 'events',
|
||||||
"text": "Events B",
|
'text': 'Events B',
|
||||||
"category": "foo",
|
'category': 'foo',
|
||||||
"category_label": "Foo",
|
'category_label': 'Foo',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"slug": "meetings-a",
|
'slug': 'meetings-a',
|
||||||
"kind": "meetings",
|
'kind': 'meetings',
|
||||||
"text": "Meetings A",
|
'text': 'Meetings A',
|
||||||
"category": None,
|
'category': None,
|
||||||
"category_label": None,
|
'category_label': None,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"slug": "virtual-b",
|
'slug': 'virtual-b',
|
||||||
"kind": "virtual",
|
'kind': 'virtual',
|
||||||
"text": "Virtual B",
|
'text': 'Virtual B',
|
||||||
"category": "foo",
|
'category': 'foo',
|
||||||
"category_label": "Foo",
|
'category_label': 'Foo',
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -127,21 +127,21 @@ def test_refresh_agendas(mock_collect):
|
||||||
assert Agenda.objects.count() == 2
|
assert Agenda.objects.count() == 2
|
||||||
agenda1 = Agenda.objects.all().order_by('pk')[0]
|
agenda1 = Agenda.objects.all().order_by('pk')[0]
|
||||||
agenda2 = Agenda.objects.all().order_by('pk')[1]
|
agenda2 = Agenda.objects.all().order_by('pk')[1]
|
||||||
assert agenda1.label == "Events A"
|
assert agenda1.label == 'Events A'
|
||||||
assert agenda1.slug == "events-a"
|
assert agenda1.slug == 'events-a'
|
||||||
assert agenda1.category_label is None
|
assert agenda1.category_label is None
|
||||||
assert agenda1.category_slug is None
|
assert agenda1.category_slug is None
|
||||||
assert agenda2.label == "Events B"
|
assert agenda2.label == 'Events B'
|
||||||
assert agenda2.slug == "events-b"
|
assert agenda2.slug == 'events-b'
|
||||||
assert agenda2.category_label == 'Foo'
|
assert agenda2.category_label == 'Foo'
|
||||||
assert agenda2.category_slug == 'foo'
|
assert agenda2.category_slug == 'foo'
|
||||||
|
|
||||||
# again, but some attributes are wrong
|
# again, but some attributes are wrong
|
||||||
agenda1.label = "Wrong"
|
agenda1.label = 'Wrong'
|
||||||
agenda1.category_label = 'Foo'
|
agenda1.category_label = 'Foo'
|
||||||
agenda1.category_slug = 'foo'
|
agenda1.category_slug = 'foo'
|
||||||
agenda1.save()
|
agenda1.save()
|
||||||
agenda2.label = "Wrong"
|
agenda2.label = 'Wrong'
|
||||||
agenda2.category_label is None
|
agenda2.category_label is None
|
||||||
agenda2.category_slug is None
|
agenda2.category_slug is None
|
||||||
agenda2.save()
|
agenda2.save()
|
||||||
|
@ -150,13 +150,13 @@ def test_refresh_agendas(mock_collect):
|
||||||
new_agenda1 = Agenda.objects.all().order_by('pk')[0]
|
new_agenda1 = Agenda.objects.all().order_by('pk')[0]
|
||||||
new_agenda2 = Agenda.objects.all().order_by('pk')[1]
|
new_agenda2 = Agenda.objects.all().order_by('pk')[1]
|
||||||
assert new_agenda1.pk == agenda1.pk
|
assert new_agenda1.pk == agenda1.pk
|
||||||
assert new_agenda1.label == "Events A"
|
assert new_agenda1.label == 'Events A'
|
||||||
assert new_agenda1.slug == "events-a"
|
assert new_agenda1.slug == 'events-a'
|
||||||
assert new_agenda1.category_label is None
|
assert new_agenda1.category_label is None
|
||||||
assert new_agenda1.category_slug is None
|
assert new_agenda1.category_slug is None
|
||||||
assert new_agenda2.pk == agenda2.pk
|
assert new_agenda2.pk == agenda2.pk
|
||||||
assert new_agenda2.label == "Events B"
|
assert new_agenda2.label == 'Events B'
|
||||||
assert new_agenda2.slug == "events-b"
|
assert new_agenda2.slug == 'events-b'
|
||||||
assert new_agenda2.category_label == 'Foo'
|
assert new_agenda2.category_label == 'Foo'
|
||||||
assert new_agenda2.category_slug == 'foo'
|
assert new_agenda2.category_slug == 'foo'
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,8 @@ def test_regies(app, user):
|
||||||
def test_payment_types(app, user):
|
def test_payment_types(app, user):
|
||||||
regie = Regie.objects.create(label='Bar')
|
regie = Regie.objects.create(label='Bar')
|
||||||
PaymentType.create_defaults(regie)
|
PaymentType.create_defaults(regie)
|
||||||
PaymentType.objects.create(regie=regie, label="Foo")
|
PaymentType.objects.create(regie=regie, label='Foo')
|
||||||
PaymentType.objects.create(regie=regie, label="Disabled", disabled=True)
|
PaymentType.objects.create(regie=regie, label='Disabled', disabled=True)
|
||||||
|
|
||||||
app.get('/api/regie/%s/payment-types/' % regie.slug, status=403)
|
app.get('/api/regie/%s/payment-types/' % regie.slug, status=403)
|
||||||
app.authorization = ('Basic', ('john.doe', 'password'))
|
app.authorization = ('Basic', ('john.doe', 'password'))
|
||||||
|
|
|
@ -16,7 +16,7 @@ def test_refresh_agendas(mock_refresh, app, admin_user):
|
||||||
resp = resp.click('Refresh agendas')
|
resp = resp.click('Refresh agendas')
|
||||||
assert resp.location.endswith('/manage/pricing/agendas/')
|
assert resp.location.endswith('/manage/pricing/agendas/')
|
||||||
resp = resp.follow()
|
resp = resp.follow()
|
||||||
assert "Agendas refreshed." in resp
|
assert 'Agendas refreshed.' in resp
|
||||||
assert mock_refresh.call_args_list == [mock.call()]
|
assert mock_refresh.call_args_list == [mock.call()]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'TEST': {
|
'TEST': {
|
||||||
'NAME': ('lingo-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-'))[:63],
|
'NAME': ('lingo-test-%s' % os.environ.get('BRANCH_NAME', '').replace('/', '-'))[:63],
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ KNOWN_SERVICES = {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
PASSWORD_HASHERS = ["django.contrib.auth.hashers.MD5PasswordHasher"]
|
PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
|
||||||
REST_FRAMEWORK = {
|
REST_FRAMEWORK = {
|
||||||
'EXCEPTION_HANDLER': 'lingo.api.utils.exception_handler',
|
'EXCEPTION_HANDLER': 'lingo.api.utils.exception_handler',
|
||||||
# this is the default value but by explicitely setting it
|
# this is the default value but by explicitely setting it
|
||||||
|
|
Loading…
Reference in New Issue