diff --git a/accounting/migrations/0034_change_exclusive_for_choices.py b/accounting/migrations/0034_change_exclusive_for_choices.py index 7c5aa9443..e83ab25b8 100644 --- a/accounting/migrations/0034_change_exclusive_for_choices.py +++ b/accounting/migrations/0034_change_exclusive_for_choices.py @@ -7,13 +7,25 @@ class Migration(migrations.Migration): dependencies = [ - ('accounting', '0033_add_stock_model'), + ("accounting", "0033_add_stock_model"), ] operations = [ migrations.AlterField( - model_name='product', - name='exclusively_for', - field=accounting.models.ChoiceArrayField(base_field=models.CharField(choices=[('ir-timely', 'Companies who signed IR during the IR period.'), ('ir-late', 'Companies who signed IR after the IR period.')], max_length=31), blank=True, default=list, help_text='Show this product only to the selected company types. An empty selection means showing it to every company.', size=None), + model_name="product", + name="exclusively_for", + field=accounting.models.ChoiceArrayField( + base_field=models.CharField( + choices=[ + ("ir-timely", "Companies who signed IR during the IR period."), + ("ir-late", "Companies who signed IR after the IR period."), + ], + max_length=31, + ), + blank=True, + default=list, + help_text="Show this product only to the selected company types. An empty selection means showing it to every company.", + size=None, + ), ), ] diff --git a/accounting/migrations/0035_add_specific_products.py b/accounting/migrations/0035_add_specific_products.py index 3e71e3ffe..16789f91a 100644 --- a/accounting/migrations/0035_add_specific_products.py +++ b/accounting/migrations/0035_add_specific_products.py @@ -7,21 +7,39 @@ class Migration(migrations.Migration): dependencies = [ - ('accounting', '0034_change_exclusive_for_choices'), + ("accounting", "0034_change_exclusive_for_choices"), ] operations = [ migrations.CreateModel( - name='SpecificProduct', + name="SpecificProduct", fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('unit_price', models.IntegerField()), - ('specific_product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='accounting.Product')), + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("unit_price", models.IntegerField()), + ( + "specific_product", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="accounting.Product", + ), + ), ], ), migrations.AddField( - model_name='product', - name='specific_products', - field=models.ManyToManyField(blank=True, help_text='(ONLY RELEVANT FOR PACKAGES AS ROOT PRODUCTS) These products will only be shown to the customer if they select the current package This feature was used in 2024 when silver and bronze packages lead to different prices on the same products', to='accounting.SpecificProduct'), + model_name="product", + name="specific_products", + field=models.ManyToManyField( + blank=True, + help_text="(ONLY RELEVANT FOR PACKAGES AS ROOT PRODUCTS) These products will only be shown to the customer if they select the current package This feature was used in 2024 when silver and bronze packages lead to different prices on the same products", + to="accounting.SpecificProduct", + ), ), ] diff --git a/accounting/migrations/0036_add_specific_product_description.py b/accounting/migrations/0036_add_specific_product_description.py index df17a3cf7..060b721cd 100644 --- a/accounting/migrations/0036_add_specific_product_description.py +++ b/accounting/migrations/0036_add_specific_product_description.py @@ -6,13 +6,13 @@ class Migration(migrations.Migration): dependencies = [ - ('accounting', '0035_add_specific_products'), + ("accounting", "0035_add_specific_products"), ] operations = [ migrations.AddField( - model_name='specificproduct', - name='description', + model_name="specificproduct", + name="description", field=models.TextField(blank=True, null=True), ), ] diff --git a/accounting/migrations/0037_add_product_help_texts.py b/accounting/migrations/0037_add_product_help_texts.py index 929c9c72e..94363d831 100644 --- a/accounting/migrations/0037_add_product_help_texts.py +++ b/accounting/migrations/0037_add_product_help_texts.py @@ -6,18 +6,26 @@ class Migration(migrations.Migration): dependencies = [ - ('accounting', '0036_add_specific_product_description'), + ("accounting", "0036_add_specific_product_description"), ] operations = [ migrations.AlterField( - model_name='childproduct', - name='description', - field=models.TextField(blank=True, help_text='Optional, describe why you created this child product. This will not be shown to the customer.', null=True), + model_name="childproduct", + name="description", + field=models.TextField( + blank=True, + help_text="Optional, describe why you created this child product. This will not be shown to the customer.", + null=True, + ), ), migrations.AlterField( - model_name='specificproduct', - name='description', - field=models.TextField(blank=True, help_text='Optional, describe why you created this specific product. This will not be shown to the customer.', null=True), + model_name="specificproduct", + name="description", + field=models.TextField( + blank=True, + help_text="Optional, describe why you created this specific product. This will not be shown to the customer.", + null=True, + ), ), ] diff --git a/accounting/migrations/0038_add_display_only_when_specific_for_packages.py b/accounting/migrations/0038_add_display_only_when_specific_for_packages.py index db09aa7d3..a5a7f3e7d 100644 --- a/accounting/migrations/0038_add_display_only_when_specific_for_packages.py +++ b/accounting/migrations/0038_add_display_only_when_specific_for_packages.py @@ -6,18 +6,25 @@ class Migration(migrations.Migration): dependencies = [ - ('accounting', '0037_add_product_help_texts'), + ("accounting", "0037_add_product_help_texts"), ] operations = [ migrations.AddField( - model_name='product', - name='display_only_when_specific_for_packages', - field=models.BooleanField(default=False, help_text="This product will only be shown to the customer if they select a package that has this product as a specific product. When to use this: e.g. A package is gatekeeping this product, only show the product when the package is selected. When not to use this: e.g. This product's price is only affected by one or more packages, but the product is still available for purchase without the package."), + model_name="product", + name="display_only_when_specific_for_packages", + field=models.BooleanField( + default=False, + help_text="This product will only be shown to the customer if they select a package that has this product as a specific product. When to use this: e.g. A package is gatekeeping this product, only show the product when the package is selected. When not to use this: e.g. This product's price is only affected by one or more packages, but the product is still available for purchase without the package.", + ), ), migrations.AlterField( - model_name='product', - name='specific_products', - field=models.ManyToManyField(blank=True, help_text='(ONLY RELEVANT FOR PACKAGES AS ROOT PRODUCTS) These products will only be shown to the customer if they select the current package This feature was used in 2024 when silver and bronze packages lead to different prices on the same products Neccessary is to toggle the "Display in product list" to false on for the specific product (otherwise it will be displayed with standard price).', to='accounting.SpecificProduct'), + model_name="product", + name="specific_products", + field=models.ManyToManyField( + blank=True, + help_text='(ONLY RELEVANT FOR PACKAGES AS ROOT PRODUCTS) These products will only be shown to the customer if they select the current package This feature was used in 2024 when silver and bronze packages lead to different prices on the same products Neccessary is to toggle the "Display in product list" to false on for the specific product (otherwise it will be displayed with standard price).', + to="accounting.SpecificProduct", + ), ), ] diff --git a/accounting/migrations/0039_remove_display_specific_boolean.py b/accounting/migrations/0039_remove_display_specific_boolean.py index 1e78bd2de..660d1de7b 100644 --- a/accounting/migrations/0039_remove_display_specific_boolean.py +++ b/accounting/migrations/0039_remove_display_specific_boolean.py @@ -6,12 +6,12 @@ class Migration(migrations.Migration): dependencies = [ - ('accounting', '0038_add_display_only_when_specific_for_packages'), + ("accounting", "0038_add_display_only_when_specific_for_packages"), ] operations = [ migrations.RemoveField( - model_name='product', - name='display_only_when_specific_for_packages', + model_name="product", + name="display_only_when_specific_for_packages", ), ] diff --git a/accounting/migrations/0040_something.py b/accounting/migrations/0040_something.py index 1bb6c389c..5dc8fd3b6 100644 --- a/accounting/migrations/0040_something.py +++ b/accounting/migrations/0040_something.py @@ -6,21 +6,25 @@ class Migration(migrations.Migration): dependencies = [ - ('accounting', '0039_remove_display_specific_boolean'), + ("accounting", "0039_remove_display_specific_boolean"), ] operations = [ migrations.RemoveField( - model_name='specificproduct', - name='description', + model_name="specificproduct", + name="description", ), migrations.RemoveField( - model_name='specificproduct', - name='unit_price', + model_name="specificproduct", + name="unit_price", ), migrations.AlterField( - model_name='product', - name='specific_products', - field=models.ManyToManyField(blank=True, help_text='(ONLY RELEVANT FOR PACKAGES AS ROOT PRODUCTS) These products will only be shown to the customer if they select the current package This feature was used in 2024 when silver and bronze packages lead to different prices on the same products Neccessary is to set the "Display in product list" to false on for the specific product (otherwise it will be displayed with standard price, for any package).', to='accounting.SpecificProduct'), + model_name="product", + name="specific_products", + field=models.ManyToManyField( + blank=True, + help_text='(ONLY RELEVANT FOR PACKAGES AS ROOT PRODUCTS) These products will only be shown to the customer if they select the current package This feature was used in 2024 when silver and bronze packages lead to different prices on the same products Neccessary is to set the "Display in product list" to false on for the specific product (otherwise it will be displayed with standard price, for any package).', + to="accounting.SpecificProduct", + ), ), ] diff --git a/accounting/views.py b/accounting/views.py index 5ce2e2269..7120e1346 100644 --- a/accounting/views.py +++ b/accounting/views.py @@ -348,9 +348,11 @@ def export_companys(request, year): e.company.invoice_email_address, e.company.ths_customer_id, e.company.invoice_reference, - company_order_total.get(e.company.pk) - if company_order_total.get(e.company.pk) - else None, + ( + company_order_total.get(e.company.pk) + if company_order_total.get(e.company.pk) + else None + ), ] ) diff --git a/api/serializers.py b/api/serializers.py index dc7ff4e38..e6dfe22ae 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -65,15 +65,19 @@ def exhibitor(request, exhibitor, company): ("purpose", exhibitor.catalogue_purpose), ( "logo_squared", - (exhibitor.catalogue_logo_squared.url) - if exhibitor.catalogue_logo_squared - else (MISSING_IMAGE if img_placeholder else None), + ( + (exhibitor.catalogue_logo_squared.url) + if exhibitor.catalogue_logo_squared + else (MISSING_IMAGE if img_placeholder else None) + ), ), ( "logo_freesize", - (exhibitor.catalogue_logo_freesize.url) - if exhibitor.catalogue_logo_freesize - else (MISSING_IMAGE if img_placeholder else None), + ( + (exhibitor.catalogue_logo_freesize.url) + if exhibitor.catalogue_logo_freesize + else (MISSING_IMAGE if img_placeholder else None) + ), ), ("contact_name", exhibitor.catalogue_contact_name), ("contact_email_address", exhibitor.catalogue_contact_email_address), @@ -115,9 +119,11 @@ def exhibitor(request, exhibitor, company): ), ( "cities", - exhibitor.catalogue_cities - if exhibitor.catalogue_cities is not None - else "", + ( + exhibitor.catalogue_cities + if exhibitor.catalogue_cities is not None + else "" + ), ), ( "benefits", diff --git a/banquet/serializers.py b/banquet/serializers.py index b2a1837a6..05f74abad 100644 --- a/banquet/serializers.py +++ b/banquet/serializers.py @@ -3,9 +3,9 @@ def ticket(participant): "id": participant.pk, "seat": participant.seat.name if participant.seat else "", "table": participant.seat.table.name if participant.seat else "", - "name": participant.user.get_full_name() - if participant.user - else participant.name, + "name": ( + participant.user.get_full_name() if participant.user else participant.name + ), "ticket_scanned": participant.ticket_scanned, } diff --git a/banquet/views.py b/banquet/views.py index 4e206dab9..8ae62e15e 100644 --- a/banquet/views.py +++ b/banquet/views.py @@ -617,9 +617,11 @@ def manage_invitations(request, year, banquet_pk): "pk": invitation.pk, "group": invitation.group, "user": invitation.user, - "name": invitation.user.get_full_name() - if invitation.user is not None - else invitation.name, + "name": ( + invitation.user.get_full_name() + if invitation.user is not None + else invitation.name + ), "reason": invitation.reason, "status": invitation.status, "price": invitation.price, @@ -843,9 +845,7 @@ def manage_invitation_form(request, year, banquet_pk, invitation_pk=None): if invitation is not None and invitation.participant is not None: form.fields["price"].disabled = True - form.fields[ - "price" - ].help_text = ( + form.fields["price"].help_text = ( "The price cannot be changed as the invitation has already been accepted." ) @@ -919,12 +919,16 @@ def manage_participant(request, year, banquet_pk, participant_pk): "banquet": banquet, "participant": { "pk": participant.pk, - "name": participant.user.get_full_name() - if participant.user - else participant.name, - "email_address": participant.user.email - if participant.user - else participant.email_address, + "name": ( + participant.user.get_full_name() + if participant.user + else participant.name + ), + "email_address": ( + participant.user.email + if participant.user + else participant.email_address + ), "phone_number": participant.phone_number, "dietary_restrictions": participant.dietary_restrictions, "other_dietary_restrictions": participant.other_dietary_restrictions, @@ -948,12 +952,16 @@ def manage_participants(request, year, banquet_pk): "pk": participant.pk, "company": participant.company, "user": participant.user, - "name": participant.user.get_full_name() - if participant.user - else participant.name, - "email_address": participant.user.email - if participant.user - else participant.email_address, + "name": ( + participant.user.get_full_name() + if participant.user + else participant.name + ), + "email_address": ( + participant.user.email + if participant.user + else participant.email_address + ), "alcohol": participant.alcohol, "seat": participant.seat, "invitation": participant.invitation_set.first(), @@ -1091,9 +1099,9 @@ def invitation(request, year, token): if invitation.banquet.caption_phone_number is not None: form.fields["phone_number"].help_text = invitation.banquet.caption_phone_number if invitation.banquet.caption_dietary_restrictions is not None: - form.fields[ - "dietary_restrictions" - ].help_text = invitation.banquet.caption_dietary_restrictions + form.fields["dietary_restrictions"].help_text = ( + invitation.banquet.caption_dietary_restrictions + ) can_edit = ( invitation.deadline_smart is None @@ -1297,9 +1305,9 @@ def external_invitation(request, token): if invitation.banquet.caption_phone_number is not None: form.fields["phone_number"].help_text = invitation.banquet.caption_phone_number if invitation.banquet.caption_dietary_restrictions is not None: - form.fields[ - "dietary_restrictions" - ].help_text = invitation.banquet.caption_dietary_restrictions + form.fields["dietary_restrictions"].help_text = ( + invitation.banquet.caption_dietary_restrictions + ) can_edit = ( invitation.deadline_smart is None @@ -1638,9 +1646,9 @@ def export_afterparty(request, year, banquet_pk): banquet = get_object_or_404(Banquet, pk=banquet_pk) response = HttpResponse(content_type="text/csv") - response[ - "Content-Disposition" - ] = 'attachment; filename="afterparty_participants.csv"' + response["Content-Disposition"] = ( + 'attachment; filename="afterparty_participants.csv"' + ) writer = csv.writer(response, delimiter=",", quoting=csv.QUOTE_ALL) writer.writerow(["Name", "Email Sent", "Email", "Inviter"]) diff --git a/companies/management/commands/importregistrations.py b/companies/management/commands/importregistrations.py index d01b42bdf..08f3977a0 100644 --- a/companies/management/commands/importregistrations.py +++ b/companies/management/commands/importregistrations.py @@ -133,11 +133,13 @@ def to_int_or_default(value, default_value): "will_you_send_goods_to_ths_armadas_goods_reception_before_the_fair" ], ), - transport_from_fair_type="armada_transport" - if row["we_would_like_to_use_armada_transport"] == "Yes" - else tuple_value_matching_name( - Exhibitor.transport_from_fair_types, - row["if_no_please_select_one_from_fair"], + transport_from_fair_type=( + "armada_transport" + if row["we_would_like_to_use_armada_transport"] == "Yes" + else tuple_value_matching_name( + Exhibitor.transport_from_fair_types, + row["if_no_please_select_one_from_fair"], + ) ), number_of_packages_from_fair=to_int_or_default( row["number_of_packages_from_fair"], 0 diff --git a/events/serializers.py b/events/serializers.py index 08ab5dd87..778846d96 100644 --- a/events/serializers.py +++ b/events/serializers.py @@ -19,9 +19,9 @@ def event(event, request): "event_end": int(event.date_end.strftime("%s")), "event_start_string": event.date_start.strftime("%Y-%m-%d %H:%M"), "registration_end": int(event.date_start.strftime("%s")), - "image_url": request.build_absolute_uri(event.picture.url) - if event.picture - else None, + "image_url": ( + request.build_absolute_uri(event.picture.url) if event.picture else None + ), "fee": event.fee_s, "registration_required": True, "external_event_link": event.external_event_link, diff --git a/exhibitors/api.py b/exhibitors/api.py index 1f9814e26..04d59536e 100644 --- a/exhibitors/api.py +++ b/exhibitors/api.py @@ -20,12 +20,14 @@ def serialize_booths(exhibitor): { "id": eib.booth.pk, "location": { - "parent": { - "id": eib.booth.location.parent.pk, - "name": eib.booth.location.parent.name, - } - if eib.booth.location.parent - else None, + "parent": ( + { + "id": eib.booth.location.parent.pk, + "name": eib.booth.location.parent.name, + } + if eib.booth.location.parent + else None + ), "id": eib.booth.location.pk, "name": eib.booth.location.name, }, @@ -51,15 +53,19 @@ def serialize_exhibitor(exhibitor, request): ("purpose", exhibitor.catalogue_purpose), ( "logo_squared", - (exhibitor.catalogue_logo_squared.url) - if exhibitor.catalogue_logo_squared - else (MISSING_IMAGE if img_placeholder else None), + ( + (exhibitor.catalogue_logo_squared.url) + if exhibitor.catalogue_logo_squared + else (MISSING_IMAGE if img_placeholder else None) + ), ), ( "logo_freesize", - (exhibitor.catalogue_logo_freesize.url) - if exhibitor.catalogue_logo_freesize - else (MISSING_IMAGE if img_placeholder else None), + ( + (exhibitor.catalogue_logo_freesize.url) + if exhibitor.catalogue_logo_freesize + else (MISSING_IMAGE if img_placeholder else None) + ), ), ( "industries", @@ -98,9 +104,11 @@ def serialize_exhibitor(exhibitor, request): ), ( "cities", - exhibitor.catalogue_cities - if exhibitor.catalogue_cities is not None - else "", + ( + exhibitor.catalogue_cities + if exhibitor.catalogue_cities is not None + else "" + ), ), ( "benefits", @@ -130,9 +138,11 @@ def serialize_exhibitor(exhibitor, request): ), ( "location_special", - str(exhibitor.fair_location_special) - if exhibitor.fair_location_special - else "", + ( + str(exhibitor.fair_location_special) + if exhibitor.fair_location_special + else "" + ), ), ("climate_compensation", exhibitor.climate_compensation), ("flyer", (exhibitor.flyer.url) if exhibitor.flyer else ""), @@ -181,9 +191,11 @@ def locations(request): data.append( { "id": location.pk, - "parent": {"id": location.parent.pk, "name": location.parent.name} - if location.parent - else None, + "parent": ( + {"id": location.parent.pk, "name": location.parent.name} + if location.parent + else None + ), "name": location.name, "has_map": bool(location.background), } @@ -223,17 +235,21 @@ def location(request, location_pk): data = { "id": location.pk, - "parent": {"id": location.parent.pk, "name": location.parent.name} - if location.parent - else None, + "parent": ( + {"id": location.parent.pk, "name": location.parent.name} + if location.parent + else None + ), "name": location.name, - "map": { - "url": location.background.url, - "width": location.background.width, - "height": location.background.height, - } - if location.background - else None, + "map": ( + { + "url": location.background.url, + "width": location.background.width, + "height": location.background.height, + } + if location.background + else None + ), "booths": booths, } diff --git a/exhibitors/management/commands/generate_bills.py b/exhibitors/management/commands/generate_bills.py index 5f3b09099..700919935 100644 --- a/exhibitors/management/commands/generate_bills.py +++ b/exhibitors/management/commands/generate_bills.py @@ -9,7 +9,6 @@ to list options """ - # Constants, that might change in the future? # Taken from the example php, you can probably change this if you know what you're doing static = { diff --git a/exhibitors/migrations/0072_add_application_status.py b/exhibitors/migrations/0072_add_application_status.py index 12e50d264..efa7b53d1 100644 --- a/exhibitors/migrations/0072_add_application_status.py +++ b/exhibitors/migrations/0072_add_application_status.py @@ -6,13 +6,18 @@ class Migration(migrations.Migration): dependencies = [ - ('exhibitors', '0071_add_exhibitor_tier'), + ("exhibitors", "0071_add_exhibitor_tier"), ] operations = [ migrations.AddField( - model_name='exhibitor', - name='application_status', - field=models.CharField(blank=True, choices=[('1', 'accepted'), ('2', 'rejected'), ('3', 'reserve')], max_length=255, null=True), + model_name="exhibitor", + name="application_status", + field=models.CharField( + blank=True, + choices=[("1", "accepted"), ("2", "rejected"), ("3", "reserve")], + max_length=255, + null=True, + ), ), ] diff --git a/exhibitors/migrations/0073_add_default_value.py b/exhibitors/migrations/0073_add_default_value.py index bf090475f..7ebb37ed9 100644 --- a/exhibitors/migrations/0073_add_default_value.py +++ b/exhibitors/migrations/0073_add_default_value.py @@ -6,13 +6,23 @@ class Migration(migrations.Migration): dependencies = [ - ('exhibitors', '0072_add_application_status'), + ("exhibitors", "0072_add_application_status"), ] operations = [ migrations.AlterField( - model_name='exhibitor', - name='application_status', - field=models.CharField(blank=True, choices=[('0', 'pending'), ('1', 'accepted'), ('2', 'rejected'), ('3', 'reserve')], default='0', max_length=255), + model_name="exhibitor", + name="application_status", + field=models.CharField( + blank=True, + choices=[ + ("0", "pending"), + ("1", "accepted"), + ("2", "rejected"), + ("3", "reserve"), + ], + default="0", + max_length=255, + ), ), ] diff --git a/exhibitors/migrations/0074_add_application_status_perm.py b/exhibitors/migrations/0074_add_application_status_perm.py index 43a7d782b..436fc4b2e 100644 --- a/exhibitors/migrations/0074_add_application_status_perm.py +++ b/exhibitors/migrations/0074_add_application_status_perm.py @@ -6,17 +6,43 @@ class Migration(migrations.Migration): dependencies = [ - ('exhibitors', '0073_add_default_value'), + ("exhibitors", "0073_add_default_value"), ] operations = [ migrations.AlterModelOptions( - name='exhibitor', - options={'default_permissions': [], 'ordering': ['company__name'], 'permissions': [('base', 'View the Exhibitors tab'), ('view_all', 'Always view all exhibitors'), ('create', 'Create new exhibitors'), ('modify_contact_persons', 'Modify contact persons'), ('modify_transport', 'Modify transport details'), ('modify_check_in', 'Modify check in'), ('modify_details', 'Modify details'), ('modify_booths', 'Modify booths'), ('people_count', 'Count people in locations'), ('modify_coordinates', 'Modify coordinates'), ('modify_fair_location', 'Modify Fair Location'), ('modify_application_status', 'Modify Application Status')]}, + name="exhibitor", + options={ + "default_permissions": [], + "ordering": ["company__name"], + "permissions": [ + ("base", "View the Exhibitors tab"), + ("view_all", "Always view all exhibitors"), + ("create", "Create new exhibitors"), + ("modify_contact_persons", "Modify contact persons"), + ("modify_transport", "Modify transport details"), + ("modify_check_in", "Modify check in"), + ("modify_details", "Modify details"), + ("modify_booths", "Modify booths"), + ("people_count", "Count people in locations"), + ("modify_coordinates", "Modify coordinates"), + ("modify_fair_location", "Modify Fair Location"), + ("modify_application_status", "Modify Application Status"), + ], + }, ), migrations.AlterField( - model_name='exhibitor', - name='application_status', - field=models.CharField(choices=[('0', 'pending'), ('1', 'accepted'), ('2', 'rejected'), ('3', 'reserve')], default='0', max_length=255), + model_name="exhibitor", + name="application_status", + field=models.CharField( + choices=[ + ("0", "pending"), + ("1", "accepted"), + ("2", "rejected"), + ("3", "reserve"), + ], + default="0", + max_length=255, + ), ), ] diff --git a/exhibitors/serializers.py b/exhibitors/serializers.py index 6fbb1330e..653800d82 100644 --- a/exhibitors/serializers.py +++ b/exhibitors/serializers.py @@ -11,12 +11,16 @@ def exhibitor(request, exhibitor, company): "company_website": company.website, "about": exhibitor.catalogue_about, "purpose": exhibitor.catalogue_purpose, - "logo_squared": exhibitor.catalogue_logo_squared.url - if exhibitor.catalogue_logo_squared - else (MISSING_IMAGE if img_placeholder else None), - "logo_freesize": exhibitor.catalogue_logo_freesize.url - if exhibitor.catalogue_logo_freesize - else (MISSING_IMAGE if img_placeholder else None), + "logo_squared": ( + exhibitor.catalogue_logo_squared.url + if exhibitor.catalogue_logo_squared + else (MISSING_IMAGE if img_placeholder else None) + ), + "logo_freesize": ( + exhibitor.catalogue_logo_freesize.url + if exhibitor.catalogue_logo_freesize + else (MISSING_IMAGE if img_placeholder else None) + ), "contact_name": exhibitor.catalogue_contact_name, "contact_email_address": exhibitor.catalogue_contact_email_address, "contact_phone_number": exhibitor.catalogue_contact_phone_number, @@ -40,9 +44,9 @@ def exhibitor(request, exhibitor, company): {"id": competence.pk, "name": competence.competence} for competence in exhibitor.catalogue_competences.all() ], - "cities": exhibitor.catalogue_cities - if exhibitor.catalogue_cities is not None - else "", + "cities": ( + exhibitor.catalogue_cities if exhibitor.catalogue_cities is not None else "" + ), "benefits": [ {"id": benefit.pk, "name": benefit.benefit} for benefit in exhibitor.catalogue_benefits.all() diff --git a/exhibitors/views.py b/exhibitors/views.py index 3f9a7ba7a..d2f9628ea 100644 --- a/exhibitors/views.py +++ b/exhibitors/views.py @@ -375,9 +375,11 @@ def exhibitor(request, year, pk): { "name": order.name if order.name is not None else order.product.name, "comment": order.comment, - "unit_price": order.unit_price - if order.unit_price is not None - else order.product.unit_price, + "unit_price": ( + order.unit_price + if order.unit_price is not None + else order.product.unit_price + ), "quantity": order.quantity, } ) @@ -427,9 +429,11 @@ def exhibitor(request, year, pk): contact_persons.append( { "user": user, - "role": application.delegated_role - if application is not None - else None, + "role": ( + application.delegated_role + if application is not None + else None + ), } ) diff --git a/fair/serializers.py b/fair/serializers.py index b5171c144..035c5e429 100644 --- a/fair/serializers.py +++ b/fair/serializers.py @@ -4,16 +4,20 @@ def lunch_ticket(lunch_ticket): data = { "id": lunch_ticket.pk, - "name": lunch_ticket.user.get_full_name() - if lunch_ticket.user - else lunch_ticket.company.name, - "email_address": lunch_ticket.user.email - if lunch_ticket.user - else lunch_ticket.email_address, + "name": ( + lunch_ticket.user.get_full_name() + if lunch_ticket.user + else lunch_ticket.company.name + ), + "email_address": ( + lunch_ticket.user.email if lunch_ticket.user else lunch_ticket.email_address + ), "comment": lunch_ticket.comment, - "date": lunch_ticket.time.__str__() - if lunch_ticket.time - else lunch_ticket.day.__str__(), + "date": ( + lunch_ticket.time.__str__() + if lunch_ticket.time + else lunch_ticket.day.__str__() + ), "used": lunch_ticket.used, "type": lunch_ticket.get_ticket_type(), "token": lunch_ticket.token, @@ -30,17 +34,21 @@ def lunch_ticket(lunch_ticket): def lunch_ticket_react(request, lunch_ticket): data = { "id": lunch_ticket.pk, - "name": lunch_ticket.user.get_full_name() - if lunch_ticket.user - else lunch_ticket.company.name, - "email_address": lunch_ticket.user.email - if lunch_ticket.user - else lunch_ticket.email_address, + "name": ( + lunch_ticket.user.get_full_name() + if lunch_ticket.user + else lunch_ticket.company.name + ), + "email_address": ( + lunch_ticket.user.email if lunch_ticket.user else lunch_ticket.email_address + ), "comment": lunch_ticket.comment, "day": lunch_ticket.day.__str__(), - "time": lunch_ticket.time.__str__().split(" ")[1] - if len(lunch_ticket.time.__str__().split(" ")) > 1 - else lunch_ticket.time.__str__(), + "time": ( + lunch_ticket.time.__str__().split(" ")[1] + if len(lunch_ticket.time.__str__().split(" ")) > 1 + else lunch_ticket.time.__str__() + ), "used": lunch_ticket.used, "type": lunch_ticket.get_ticket_type(), "token": lunch_ticket.token, diff --git a/fair/views.py b/fair/views.py index d1f2c0f5e..6a3eb375c 100644 --- a/fair/views.py +++ b/fair/views.py @@ -164,10 +164,12 @@ def lunchtickets(request, year): for lunchticket in lunchtickets_filtered: lunchticket["drl"] = [ - True - if dietary_restriction - in lunchticket["t"].dietary_restrictions.all() - else False + ( + True + if dietary_restriction + in lunchticket["t"].dietary_restrictions.all() + else False + ) for dietary_restriction in dietary_restrictions_all ] @@ -339,9 +341,11 @@ def tickets(request, year): serializers.lunch_ticket(lunch_ticket=lunch_ticket) for lunch_ticket in lunch_tickets ], - "banquet_participant": serializers.banquet_participant(banquet_participant) - if banquet_participant - else None, + "banquet_participant": ( + serializers.banquet_participant(banquet_participant) + if banquet_participant + else None + ), } return render( diff --git a/matching/forms.py b/matching/forms.py index 4e8d22dab..4cc333e89 100644 --- a/matching/forms.py +++ b/matching/forms.py @@ -67,9 +67,9 @@ def add_question(self, question, data): if widget: kwargs["widget"] = widget field = self.get_question_field(question, **kwargs) - self.fields[ - "question_%d" % question.pk - ] = field ## VERY IMPORTANT TO KEEP question_%d here. Other code is dependant on it + self.fields["question_%d" % question.pk] = ( + field ## VERY IMPORTANT TO KEEP question_%d here. Other code is dependant on it + ) def get_question_initial(self, question, data): """Get the initial value that we should use in the Form diff --git a/orders/forms.py b/orders/forms.py index e4c4d828c..85e643435 100644 --- a/orders/forms.py +++ b/orders/forms.py @@ -14,9 +14,9 @@ def __init__(self, exhibitor, *args, **kwargs): super(ElectricityOrderForm, self).__init__(*args, **kwargs) if instance == None: self.fields["exhibitor"].initial = exhibitor.pk - self.fields[ - "exhibitor" - ].disabled = True # make sure exhibitor field is not editable + self.fields["exhibitor"].disabled = ( + True # make sure exhibitor field is not editable + ) self.fields["exhibitor"].widget = HiddenInput() @@ -31,12 +31,12 @@ def __init__(self, exhibitor, *args, **kwargs): if instance == None: self.fields["exhibitor"].initial = exhibitor.pk self.fields["amount"].initial = 1 - self.fields[ - "exhibitor" - ].disabled = True # make sure exhibitor field is not editable - self.fields[ - "amount" - ].disabled = True # make sure exhibitor field is not editable + self.fields["exhibitor"].disabled = ( + True # make sure exhibitor field is not editable + ) + self.fields["amount"].disabled = ( + True # make sure exhibitor field is not editable + ) self.fields["exhibitor"].widget = HiddenInput() self.fields["amount"].widget = HiddenInput() diff --git a/recruitment/views.py b/recruitment/views.py index 863d2fd4a..9eeb42f0d 100644 --- a/recruitment/views.py +++ b/recruitment/views.py @@ -1196,9 +1196,9 @@ def recruitment_application_interview( interview_planning_form = InterviewPlanningForm( request.POST or None, instance=application ) - interview_planning_form.fields[ - "recommended_role" - ].queryset = application.recruitment_period.recruitable_roles + interview_planning_form.fields["recommended_role"].queryset = ( + application.recruitment_period.recruitable_roles + ) used_slots = [] @@ -1282,9 +1282,9 @@ def recruitment_application_interview( if "interviewer" in interview_planning_form.fields: interview_planning_form.fields["interviewer"].choices = interviewers_by_language if "interviewer2" in interview_planning_form.fields: - interview_planning_form.fields[ - "interviewer2" - ].choices = interviewers_by_language + interview_planning_form.fields["interviewer2"].choices = ( + interviewers_by_language + ) RoleDelegationForm = modelform_factory( RecruitmentApplication, fields=["delegated_role", "superior_user", "status"] @@ -1293,9 +1293,9 @@ def recruitment_application_interview( role_delegation_form = RoleDelegationForm( request.POST or None, instance=application ) - role_delegation_form.fields[ - "delegated_role" - ].queryset = application.recruitment_period.recruitable_roles + role_delegation_form.fields["delegated_role"].queryset = ( + application.recruitment_period.recruitable_roles + ) role_delegation_form.fields["superior_user"].choices = [("", "---------")] + [ (interviewer.pk, interviewer.get_full_name()) for interviewer in interviewers ] diff --git a/register/forms.py b/register/forms.py index 5acff66a3..35ca8e6c8 100644 --- a/register/forms.py +++ b/register/forms.py @@ -344,7 +344,7 @@ class Meta: #'catalogue_purpose': 'Your organisation\'s purpose', "catalogue_logo_squared": "Upload your company's squared logotype. (required to sign contract)", "catalogue_logo_freesize": "Upload your company's logotype in any dimensions, in addition to the squared logotype.", - "catalogue_cities": "Please write the main cities where your company operates. Separate the cities with commas." + "catalogue_cities": "Please write the main cities where your company operates. Separate the cities with commas.", #'catalogue_founded': 'Which year was the company founded?' } diff --git a/register/migrations/0007_add_timely_status.py b/register/migrations/0007_add_timely_status.py index b19a72373..30de71bac 100644 --- a/register/migrations/0007_add_timely_status.py +++ b/register/migrations/0007_add_timely_status.py @@ -6,13 +6,16 @@ class Migration(migrations.Migration): dependencies = [ - ('register', '0006_add_signup_log_ip'), + ("register", "0006_add_signup_log_ip"), ] operations = [ migrations.AddField( - model_name='signupcontract', - name='is_timely', - field=models.BooleanField(default=True, help_text='(ONLY RELEVANT FOR IR) A contract is timely if it is signed before the IR period ends.'), + model_name="signupcontract", + name="is_timely", + field=models.BooleanField( + default=True, + help_text="(ONLY RELEVANT FOR IR) A contract is timely if it is signed before the IR period ends.", + ), ), ]