Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
ewdurbin committed Jan 5, 2024
2 parents 0109c6e + db9d241 commit 95f98c7
Show file tree
Hide file tree
Showing 8 changed files with 60 additions and 14 deletions.
4 changes: 2 additions & 2 deletions fixtures/boxes.json
Original file line number Diff line number Diff line change
Expand Up @@ -654,9 +654,9 @@
"created": "2014-11-13T21:49:22.048Z",
"updated": "2021-07-29T21:40:21.030Z",
"label": "download-dev",
"content": "<h2>Information about specific ports, and developer info</h2>\r\n\r\n<ul>\r\n <li><a href=\"/downloads/windows/\">Windows</a></li>\r\n <li><a href=\"/downloads/macos/\">Macintosh</a></li>\r\n <li><a href=\"/download/other/\">Other platforms</a></li>\r\n <li><a href=\"/downloads/source/\">Source</a></li>\r\n <li><a href=\"/dev/\">Python Developer's Guide</a></li>\r\n <li><a href=\"http://bugs.python.org\">Python Issue Tracker</a></li>\r\n</ul>",
"content": "<h2>Information about specific ports, and developer info</h2>\r\n\r\n<ul>\r\n <li><a href=\"/downloads/windows/\">Windows</a></li>\r\n <li><a href=\"/downloads/macos/\">Macintosh</a></li>\r\n <li><a href=\"/download/other/\">Other platforms</a></li>\r\n <li><a href=\"/downloads/source/\">Source</a></li>\r\n <li><a href=\"/dev/\">Python Developer's Guide</a></li>\r\n <li><a href=\"https://github.com/python/cpython/issues\">Python Issue Tracker</a></li>\r\n</ul>",
"content_markup_type": "html",
"_content_rendered": "<h2>Information about specific ports, and developer info</h2>\r\n\r\n<ul>\r\n <li><a href=\"/downloads/windows/\">Windows</a></li>\r\n <li><a href=\"/downloads/macos/\">Macintosh</a></li>\r\n <li><a href=\"/download/other/\">Other platforms</a></li>\r\n <li><a href=\"/downloads/source/\">Source</a></li>\r\n <li><a href=\"/dev/\">Python Developer's Guide</a></li>\r\n <li><a href=\"http://bugs.python.org\">Python Issue Tracker</a></li>\r\n</ul>"
"_content_rendered": "<h2>Information about specific ports, and developer info</h2>\r\n\r\n<ul>\r\n <li><a href=\"/downloads/windows/\">Windows</a></li>\r\n <li><a href=\"/downloads/macos/\">Macintosh</a></li>\r\n <li><a href=\"/download/other/\">Other platforms</a></li>\r\n <li><a href=\"/downloads/source/\">Source</a></li>\r\n <li><a href=\"/dev/\">Python Developer's Guide</a></li>\r\n <li><a href=\"https://github.com/python/cpython/issues\">Python Issue Tracker</a></li>\r\n</ul>"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion fixtures/sitetree_menus.json
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@
"fields": {
"title": "PEP Index",
"hint": "",
"url": "http://python.org/dev/peps/",
"url": "https://peps.python.org",
"urlaspattern": false,
"tree": 1,
"hidden": false,
Expand Down
7 changes: 5 additions & 2 deletions sponsors/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django import forms
from django.conf import settings
from django.contrib.admin.widgets import AdminDateWidget
from django.core.validators import FileExtensionValidator
from django.db.models import Q
from django.utils import timezone
from django.utils.functional import cached_property
Expand Down Expand Up @@ -225,10 +226,11 @@ class SponsorshipApplicationForm(forms.Form):
help_text="For display on our sponsor webpage. High resolution PNG or JPG, smallest dimension no less than 256px",
required=False,
)
print_logo = forms.ImageField(
print_logo = forms.FileField(
label="Sponsor print logo",
help_text="For printed materials, signage, and projection. SVG or EPS",
required=False,
validators=[FileExtensionValidator(['eps', 'epsf' 'epsi', 'svg', 'png'])],
)

primary_phone = forms.CharField(
Expand Down Expand Up @@ -557,10 +559,11 @@ class SponsorUpdateForm(forms.ModelForm):
help_text="For display on our sponsor webpage. High resolution PNG or JPG, smallest dimension no less than 256px",
required=False,
)
print_logo = forms.ImageField(
print_logo = forms.FileField(
widget=forms.widgets.FileInput,
help_text="For printed materials, signage, and projection. SVG or EPS",
required=False,
validators=[FileExtensionValidator(['eps', 'epsf' 'epsi', 'svg', 'png'])],
)

def __init__(self, *args, **kwargs):
Expand Down
20 changes: 12 additions & 8 deletions sponsors/management/commands/create_pycon_vouchers_for_sponsors.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,26 @@
)

BENEFITS = {
121: {
"internal_name": "full_conference_passes_2023_code",
183: {
"internal_name": "full_conference_passes_code_2024",
"voucher_type": "SPNS_COMP_",
},
139: {
"internal_name": "expo_hall_only_passes_2023_code",
201: {
"internal_name": "expo_hall_only_passes_code_2024",
"voucher_type": "SPNS_EXPO_COMP_",
},
148: {
"internal_name": "additional_full_conference_passes_2023_code",
208: {
"internal_name": "additional_full_conference_passes_code_2024",
"voucher_type": "SPNS_ADDL_DISC_REG_",
},
166: {
"internal_name": "online_only_conference_passes_2023_code",
225: {
"internal_name": "online_only_conference_passes_2024",
"voucher_type": "SPNS_ONLINE_COMP_",
},
237: {
"internal_name": "additional_expo_hall_only_passes_2024",
"voucher_type": "SPNS_EXPO_DISC_",
},
}


Expand Down
19 changes: 19 additions & 0 deletions sponsors/migrations/0099_auto_20231224_1854.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.24 on 2023-12-24 18:54

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('sponsors', '0098_auto_20231219_1910'),
]

operations = [
migrations.AlterField(
model_name='sponsor',
name='print_logo',
field=models.FileField(blank=True, help_text='For printed materials, signage, and projection. SVG or EPS', null=True, upload_to='sponsor_print_logos', validators=[django.core.validators.FileExtensionValidator(['eps', 'epsfepsi', 'svg', 'png'])], verbose_name='Print logo'),
),
]
2 changes: 2 additions & 0 deletions sponsors/models/sponsors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"""
from allauth.account.models import EmailAddress
from django.conf import settings
from django.core.validators import FileExtensionValidator
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
from django.template.defaultfilters import slugify
Expand Down Expand Up @@ -51,6 +52,7 @@ class Sponsor(ContentManageable):
)
print_logo = models.FileField(
upload_to="sponsor_print_logos",
validators=[FileExtensionValidator(['eps', 'epsf' 'epsi', 'svg', 'png'])],
blank=True,
null=True,
verbose_name="Print logo",
Expand Down
18 changes: 18 additions & 0 deletions sponsors/tests/test_forms.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
from pathlib import Path

from django.core.files.uploadedfile import SimpleUploadedFile
from model_bakery import baker

from django.conf import settings
Expand Down Expand Up @@ -438,6 +441,21 @@ def test_create_sponsor_with_valid_data_for_non_required_inputs(
self.assertEqual(sponsor.landing_page_url, "https://companyx.com")
self.assertEqual(sponsor.twitter_handle, "@companyx")

def test_create_sponsor_with_svg_for_print_logo(
self,
):
tick_svg = Path(settings.STATICFILES_DIRS[0]) / "img"/"sponsors"/"tick.svg"
with tick_svg.open("rb") as fd:
uploaded_svg = SimpleUploadedFile("tick.svg", fd.read())
self.files["print_logo"] = uploaded_svg

form = SponsorshipApplicationForm(self.data, self.files)
self.assertTrue(form.is_valid(), form.errors)

sponsor = form.save()

self.assertTrue(sponsor.print_logo)

def test_use_previous_user_sponsor(self):
contact = baker.make(SponsorContact, user__email="foo@foo.com")
self.data = {"sponsor": contact.sponsor.id}
Expand Down
2 changes: 1 addition & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<link rel="author" href="/humans.txt">

<link rel="alternate" type="application/rss+xml" title="Python Enhancement Proposals"
href="https://www.python.org/dev/peps/peps.rss/">
href="https://peps.python.org/peps.rss">
<link rel="alternate" type="application/rss+xml" title="Python Job Opportunities"
href="https://www.python.org/jobs/feed/rss/">
<link rel="alternate" type="application/rss+xml" title="Python Software Foundation News"
Expand Down

0 comments on commit 95f98c7

Please sign in to comment.