This repository has been archived by the owner on Sep 3, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31 from DemocracyClub/remove-signup-server
Slim down project to only use event_bridge
- Loading branch information
Showing
32 changed files
with
282 additions
and
830 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: Tests | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12.0-rc.3"] | ||
django-version: [">4.2,<5", "==5.0a1"] | ||
exclude: | ||
# exclude Django 5 on Python 3.9 | ||
- python-version: "3.9" | ||
django-version: "==5.0a1" | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Update Pip | ||
run: | | ||
python -m pip install --upgrade pip | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install "Django${{ matrix.django-version }}" | ||
python -m pip install . | ||
python -m pip install -r testing_requirements.txt | ||
- name: Lint | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
black . --check | ||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | ||
ruff . | ||
- name: Test with pytest | ||
run: | | ||
python run_tests.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,34 @@ | ||
from django import forms | ||
from django.core.validators import RegexValidator | ||
|
||
from .constants import ELECTION_REMINDERS_FORM_PREFIX, MAILING_LIST_FORM_PREFIX | ||
from .constants import MAILING_LIST_FORM_PREFIX | ||
|
||
|
||
def emails_not_accepted(value): | ||
if '@' in value: | ||
raise forms.ValidationError("Please enter your full name, not your email address.") | ||
if "@" in value: | ||
raise forms.ValidationError( | ||
"Please enter your full name, not your email address." | ||
) | ||
|
||
|
||
class EmailSignupForm(forms.Form): | ||
full_name = forms.CharField( | ||
required=True, | ||
max_length=1000, | ||
required=True, | ||
max_length=1000, | ||
label="Full Name", | ||
validators=[emails_not_accepted], | ||
widget=forms.TextInput(attrs={'autocomplete': 'off', 'pattern': '[^@]+', 'title': 'Please enter your full name, not your email address.'}) | ||
widget=forms.TextInput( | ||
attrs={ | ||
"autocomplete": "off", | ||
"pattern": "[^@]+", | ||
"title": "Please enter your full name, not your email address.", | ||
} | ||
), | ||
) | ||
email = forms.EmailField(required=True, max_length=255, label="Email") | ||
source_url = forms.CharField(widget=forms.HiddenInput()) | ||
|
||
class ElectionRemindersSignupForm(EmailSignupForm): | ||
|
||
prefix = ELECTION_REMINDERS_FORM_PREFIX | ||
|
||
main_list = forms.BooleanField( | ||
required=False, | ||
initial=False, | ||
label="Subscribe to the Democracy Club mailing list", | ||
) | ||
election_reminders = forms.BooleanField(initial=True, widget=forms.HiddenInput()) | ||
|
||
|
||
class MailingListSignupForm(EmailSignupForm): | ||
|
||
prefix = MAILING_LIST_FORM_PREFIX | ||
|
||
main_list = forms.BooleanField(initial=True, widget=forms.HiddenInput()) |
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
Oops, something went wrong.