Skip to content

Commit

Permalink
Merge pull request #936 from amakarudze/fix-928
Browse files Browse the repository at this point in the history
Remove Covid-19 restrictions from in-person form
  • Loading branch information
amakarudze authored Jan 29, 2024
2 parents a689641 + b762d32 commit e44120b
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 97 deletions.
7 changes: 0 additions & 7 deletions core/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
from urlextract import URLExtract

today = date.today()

Expand All @@ -22,9 +21,3 @@ def validate_event_date(e_date):
def validate_future_date(e_date):
if date(e_date.year, e_date.month, e_date.day) - today < timedelta(days=0):
raise ValidationError(_("Event date should be in the future"))


def validate_local_restrictions(local_restrictions):
extractor = URLExtract()
if not extractor.has_urls(local_restrictions):
raise ValidationError(_("Please provide a link to your government website outlining this."))
10 changes: 0 additions & 10 deletions organize/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
validate_approximatedate,
validate_event_date,
validate_future_date,
validate_local_restrictions,
)

from .constants import INVOLVEMENT_CHOICES
Expand Down Expand Up @@ -97,11 +96,8 @@ class WorkshopForm(forms.Form):
venue = forms.CharField(widget=forms.Textarea(attrs={"class": "compact-input"}))
sponsorship = forms.CharField(widget=forms.Textarea(attrs={"class": "compact-input"}))
coaches = forms.CharField(widget=forms.Textarea(attrs={"class": "compact-input"}))
local_restrictions = forms.CharField(required=True, widget=forms.Textarea(attrs={"class": "compact-input"}))
safety = forms.CharField(required=True, widget=forms.Textarea(attrs={"class": "compact-input"}))
diversity = forms.CharField(widget=forms.Textarea(attrs={"class": "compact-input"}))
additional = forms.CharField(widget=forms.Textarea(attrs={"class": "compact-input"}))
confirm_covid_19_protocols = forms.BooleanField()

def clean_date(self):
date = self.cleaned_data.get("date")
Expand All @@ -115,12 +111,6 @@ def clean_date(self):
def get_data_for_saving(self):
return self.cleaned_data

def clean_local_restrictions(self):
local_restrictions = self.cleaned_data.get("local_restrictions")
# Check if organizer provides link to government website
validate_local_restrictions(local_restrictions)
return local_restrictions


class RemoteWorkshopForm(forms.Form):
date = ApproximateDateFormField(widget=forms.TextInput(attrs={"class": "compact-input"}))
Expand Down
58 changes: 0 additions & 58 deletions templates/organize/form/step5_workshop.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,43 +153,6 @@ <h1>{% trans "Tell us all about your Django Girls event!" %}</h1>
</ul>
</section>

<section class="form-section">
<label class="form-section-heading{% if form.local_restrictions.field.required %} required{% endif %}">{% trans "What are your current local restrictions?" %}</label>
<p class="form-section-subhead">{% trans "Please also provide a link to your government website outlining this." %}</p>

<ul class="row">
<li class="col-sm-12 col-md-9">
{{ wizard.form.local_restrictions }}
{% if wizard.form.local_restrictions.errors %}
<ul class="error-list">
{% for error in wizard.form.local_restrictions.errors %}
<li class="error">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</li>
</ul>
</section>


<section class="form-section">
<label class="form-section-heading{% if form.safety.field.required %} required{% endif %}">{% trans "How will you host your in-person workshop during the Covid-19 pandemic?" %}</label>
<p class="form-section-subhead">{% trans "Please provide information on how you plan to ensure safety for attendees and coaches for your in-person workshop during the Covid-19 pandemic." %}</p>

<ul class="row">
<li class="col-sm-12 col-md-9">
{{ wizard.form.safety }}
{% if wizard.form.safety.errors %}
<ul class="error-list">
{% for error in wizard.form.safety.errors %}
<li class="error">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</li>
</ul>
</section>

<section class="form-section">
<label class="form-section-heading{% if form.diversity.field.required %} required{% endif %}">{% trans "How do you intent to make your workshop inclusive and promote diversity?" %}</label>
<p class="form-section-subhead">{% trans "Please tell us how you intend to make sure your workshop is inclusive to people from marginalised communities and promote diversity." %}</p>
Expand Down Expand Up @@ -226,27 +189,6 @@ <h1>{% trans "Tell us all about your Django Girls event!" %}</h1>
</ul>
</section>

<section class="form-section">
<label class="form-section-heading{% if form.confirm_covid_19_protocols.field.required %} required{% endif %}">{% trans "Will you change your workshop to remote or postpone if the situation changes in your country?" %}</label>
<p class="form-section-subhead">{% trans "Confirm you will postpone or host remote workshop if Covid-19 situation changes in your city." %}</p>

<ul class="row">
<li class="col-sm-12 col-md-9 checkbox-wrapper">
{{ wizard.form.confirm_covid_19_protocols }}
<label>
{% trans " I confirm that should my local restrictions change to prevent the workshop from going ahead in person safely, I will change to a remote workshop, or postpone until restrictions are lifted and it is safe to go ahead." %}
</label>
{% if wizard.form.confirm_covid_19_protocols.errors %}
<ul class="error-list">
{% for error in wizard.form.confirm_covid_19_protocols.errors %}
<li class="error">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</li>
</ul>
</section>

<section class="form-section">
<ul class="row">
<li class="col-sm-12 col-md-9">
Expand Down
13 changes: 0 additions & 13 deletions tests/organize/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,8 @@ def previous_organizer_in_person(past_event):
"workshop-venue": "Beira Hall",
"workshop-sponsorship": "My employer will sponsor the event.",
"workshop-coaches": "My colleagues will coach at the event.",
"workshop-local_restrictions": "All restrictions relaxed. https://somegov.gov",
"workshop-safety": "Social distancing",
"workshop-diversity": "Promote on social media and use videos",
"workshop-additional": "None",
"workshop-confirm_covid_19_protocols": True,
"organize_form_wizard-current_step": "workshop",
}

Expand Down Expand Up @@ -209,11 +206,8 @@ def new_organizer_in_person():
"workshop-venue": "Baixa Mall",
"workshop-sponsorship": "We have a few local companies we can approach.",
"workshop-coaches": "We have many Python developers here.",
"workshop-local_restrictions": "All restrictions relaxed. https://somegov.gov",
"workshop-safety": "We will practise social distancing, wear masks and sanitize hands,",
"workshop-diversity": "Promote on social media and use videos",
"workshop-additional": "None",
"workshop-confirm_covid_19_protocols": True,
"organize_form_wizard-current_step": "workshop",
}

Expand All @@ -237,11 +231,8 @@ def workshop_form_valid_date():
"venue": "Baixa Mall",
"sponsorship": "We have a few local companies we can approach.",
"coaches": "We have many Python developers here.",
"local_restrictions": "Maximum number of attendees is 50. https://somegovt.com/",
"safety": "We will practise social distancing, wear masks and sanitize hands,",
"diversity": "Promote on social media and use videos",
"additional": "None",
"confirm_covid_19_protocols": True,
}
return data

Expand Down Expand Up @@ -334,7 +325,6 @@ def workshop_form_date_year_only():
"venue": "Baixa Mall",
"sponsorship": "We have a few local companies we can approach.",
"coaches": "We have many Python developers here.",
"safety": "We will practise social distancing, wear masks and sanitize hands,",
"diversity": "Promote on social media and use videos",
"additional": "None",
}
Expand Down Expand Up @@ -447,11 +437,8 @@ def workshop_form_invalid_no_link():
"venue": "Baixa Mall",
"sponsorship": "We have a few local companies we can approach.",
"coaches": "We have many Python developers here.",
"local_restrictions": "Maximum number of attendees is 50 and social distancing of 1.5m apart.",
"safety": "We will practise social distancing, wear masks and sanitize hands,",
"diversity": "Promote on social media and use videos",
"additional": "None",
"confirm_covid_19_protocols": True,
}
return data

Expand Down
9 changes: 0 additions & 9 deletions tests/organize/test_forms.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import re

from organize.forms import RemoteWorkshopForm, WorkshopForm


Expand Down Expand Up @@ -53,10 +51,3 @@ def test_workshop_form_date_year_only(workshop_form_date_year_only):
form = WorkshopForm(data=workshop_form_date_year_only)
assert not form.is_valid()
assert form.errors["date"] == ["Event date can't be a year only. " "Please, provide at least a month and a year."]


def test_workshop_form_local_restrictions_no_link(workshop_form_invalid_no_link):
form = WorkshopForm(data=workshop_form_invalid_no_link)
print(re.findall(r"(https?://[^\s]+)", workshop_form_invalid_no_link["local_restrictions"]))
assert not form.is_valid()
assert form.errors["local_restrictions"] == ["Please provide a link to your government website outlining this."]

0 comments on commit e44120b

Please sign in to comment.