Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d02143

Browse files
authored
Sponsorship application tweaks (python#1730)
* sponsorship: add twitter handle to Sponsor model and application form* sponsorship: Update text on the submit button for sponsorship application
1 parent6722104 commit6d02143

File tree

5 files changed

+63
-10
lines changed

5 files changed

+63
-10
lines changed

‎sponsors/forms.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,13 @@ class SponsorshipApplicationForm(forms.Form):
148148
)
149149
landing_page_url=forms.URLField(
150150
label="Sponsor landing page",
151-
help_text="Sponsor landing page URL. This may be provided by the sponsor, however the linked page may not contain any sales or marketing information.",
151+
help_text="Landing page URL. The linked page may not contain any sales or marketing information.",
152+
required=False,
153+
)
154+
twitter_handle=forms.CharField(
155+
max_length=32,
156+
label="Twitter handle",
157+
help_text="For promotion of your sponsorship on social media.",
152158
required=False,
153159
)
154160
web_logo=forms.ImageField(
@@ -300,6 +306,7 @@ def save(self):
300306
country=self.cleaned_data["country"],
301307
description=self.cleaned_data.get("description",""),
302308
landing_page_url=self.cleaned_data.get("landing_page_url",""),
309+
twitter_handle=self.cleaned_data["twitter_handle"],
303310
print_logo=self.cleaned_data.get("print_logo"),
304311
)
305312
contacts= [f.save(commit=False)forfinself.contacts_formset.forms]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 2.0.13 on 2021-02-12 14:46
2+
3+
fromdjango.dbimportmigrations,models
4+
5+
6+
classMigration(migrations.Migration):
7+
8+
dependencies= [
9+
("sponsors","0018_auto_20201201_1659"),
10+
]
11+
12+
operations= [
13+
migrations.AddField(
14+
model_name="sponsor",
15+
name="twitter_handle",
16+
field=models.CharField(
17+
blank=True,
18+
max_length=32,
19+
null=True,
20+
verbose_name="Sponsor twitter hanlde",
21+
),
22+
),
23+
]

‎sponsors/models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ class Sponsor(ContentManageable):
442442
verbose_name="Sponsor landing page",
443443
help_text="Sponsor landing page URL. This may be provided by the sponsor, however the linked page may not contain any sales or marketing information.",
444444
)
445+
twitter_handle=models.CharField(
446+
max_length=32,# Actual limit set by twitter is 15 characters, but that may change?
447+
blank=True,
448+
null=True,
449+
verbose_name="Sponsor twitter hanlde",
450+
)
445451
web_logo=models.ImageField(
446452
upload_to="sponsor_web_logos",
447453
verbose_name="Sponsor web logo",

‎sponsors/tests/test_forms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def test_create_sponsor_with_valid_data_for_non_required_inputs(
235235
):
236236
self.data["description"]="Important company"
237237
self.data["landing_page_url"]="https://companyx.com"
238+
self.data["twitter_handle"]="@companyx"
238239
self.files["print_logo"]=get_static_image_file_as_upload(
239240
"psf-logo_print.png","logo_print.png"
240241
)
@@ -248,6 +249,7 @@ def test_create_sponsor_with_valid_data_for_non_required_inputs(
248249
self.assertTrue(sponsor.print_logo)
249250
self.assertFalse(form.user_with_previous_sponsors)
250251
self.assertEqual(sponsor.landing_page_url,"https://companyx.com")
252+
self.assertEqual(sponsor.twitter_handle,"@companyx")
251253

252254
deftest_use_previous_user_sponsor(self):
253255
contact=baker.make(SponsorContact,user__email="foo@foo.com")

‎templates/sponsors/new_sponsorship_application_form.html

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,29 @@ <h1>Submit Sponsorship Information</h1>
7070
{% endif %}
7171
</p>
7272

73-
<pclass="form_field">
74-
<label>{{ form.landing_page_url.label }}<spanclass="error-message">{% if form.landing_page_url.errors %}{{ form.landing_page_url.errors.as_text }}</span>{% endif %}</label>
75-
{% render_field form.landing_page_url %}
76-
{% if form.landing_page_url.help_text %}
77-
<br/>
78-
<spanclass="helptext">{{ form.landing_page_url.help_text }}</span>
79-
{% endif %}
80-
</p>
73+
<divclass="inline_fields">
74+
<div>
75+
<pclass="form_field">
76+
<label>{{ form.landing_page_url.label }}<spanclass="error-message">{% if form.landing_page_url.errors %}{{ form.landing_page_url.errors.as_text }}</span>{% endif %}</label>
77+
{% render_field form.landing_page_url %}
78+
{% if form.landing_page_url.help_text %}
79+
<br/>
80+
<spanclass="helptext">{{ form.landing_page_url.help_text }}</span>
81+
{% endif %}
82+
</p>
83+
</div>
84+
85+
<div>
86+
<pclass="form_field">
87+
<label>{{ form.twitter_handle.label }}<spanclass="error-message">{% if form.twitter_handle.errors %}{{ form.twitter_handle.errors.as_text }}</span>{% endif %}</label>
88+
{% render_field form.twitter_handle %}
89+
{% if form.twitter_handle.help_text %}
90+
<br/>
91+
<spanclass="helptext">{{ form.twitter_handle.help_text }}</span>
92+
{% endif %}
93+
</p>
94+
</div>
95+
</div>
8196

8297
<pclass="form_field">
8398
<label>{{ form.country.label }}<spanclass="error-message">{% if form.country.errors %}{{ form.country.errors.as_text }}</span>{% endif %}</label>
@@ -203,7 +218,7 @@ <h1>Contacts</h1>
203218

204219
</div>
205220

206-
<inputid="submit-btn"type="submit"value="Submit">
221+
<inputid="submit-btn"type="submit"value="Apply">
207222
</form>
208223
</article>
209224

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp