-
-
Notifications
You must be signed in to change notification settings - Fork 66
23 create speaker mgmt #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mayakerostasia
wants to merge
8
commits into
pyladies:main
Choose a base branch
from
mayakerostasia:23-create-speaker-mgmt
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b98d655
Adding Speakers Application skeleton
mayakerostasia 1cbbfd4
Merge branch 'pyladies:main' into 23-create-speaker-mgmt
mayakerostasia 7ae2469
Merge with home computer
mayakerostasia edd4ba7
xfer to home computer
mayakerostasia df70215
fixing lint errors
1140d72
update ignore to include encrypted env files
1711902
added Events and Load Event Speakers Button when superuser
e3d67bb
Merge branch 'main' into 23-create-speaker-mgmt
Mariatta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ | |
| "storages", | ||
| "portal", | ||
| "volunteer", | ||
| "speaker", | ||
| "portal_account", | ||
| "widget_tweaks", | ||
| ] | ||
|
|
||
This file contains hidden or 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
Empty file.
Empty file.
This file contains hidden or 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,6 @@ | ||
| from django.apps import AppConfig | ||
|
|
||
|
|
||
| class VolunteerConfig(AppConfig): | ||
| default_auto_field = "django.db.models.BigAutoField" | ||
| name = "speaker" |
This file contains hidden or 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,31 @@ | ||
| from enum import StrEnum | ||
|
|
||
|
|
||
| # class RoleTypes(StrEnum): | ||
| # """Role types for the volunteer.""" | ||
|
|
||
| # ADMIN = "Admin" | ||
| # STAFF = "Staff" | ||
| # VENDOR = "Vendor" | ||
| # VOLUNTEER = "Volunteer" | ||
|
|
||
|
|
||
| class ApplicationStatus(StrEnum): | ||
| """Application status for the volunteer.""" | ||
|
|
||
| PENDING = "Pending Review" | ||
| APPROVED = "Approved" | ||
| REJECTED = "Rejected" | ||
| CANCELLED = "Cancelled" | ||
|
|
||
|
|
||
| class Region(StrEnum): | ||
| """Region where the volunteer usually reside.""" | ||
|
|
||
| NO_REGION = "" | ||
| ASIA = "Asia" | ||
| EUROPE = "Europe" | ||
| NORTH_AMERICA = "North America" | ||
| SOUTH_AMERICA = "South America" | ||
| AFRICA = "Africa" | ||
| OCEANIA = "Oceania" |
Empty file.
Empty file.
This file contains hidden or 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,67 @@ | ||
| import re | ||
|
|
||
| from django import forms | ||
| from django.core.exceptions import ValidationError | ||
| from django.forms import ModelForm | ||
| from django.forms.widgets import SelectMultiple | ||
|
|
||
| from .languages import LANGUAGES | ||
| from .models import SpeakerProfile | ||
|
|
||
| class LanguageSelectMultiple(SelectMultiple): | ||
| """ | ||
| A custom widget for selecting multiple languages with autocomplete. | ||
| """ | ||
|
|
||
| def __init__(self, attrs=None, choices=()): | ||
| default_attrs = { | ||
| "class": "form-control select2-multiple", | ||
| "data-placeholder": "Start typing to select languages...", | ||
| } | ||
| if attrs: | ||
| default_attrs.update(attrs) | ||
| super().__init__(default_attrs, choices) | ||
|
|
||
| class SpeakerProfileForm(ModelForm): | ||
|
|
||
| # discord_username = forms.CharField(required=True) | ||
| additional_comments = forms.CharField(widget=forms.Textarea, required=False) | ||
|
|
||
| class Meta: | ||
| model = SpeakerProfile | ||
| exclude = ["user", "application_status"] | ||
| help_texts = { | ||
| # "github_username": "GitHub username (e.g., username)", | ||
| # "discord_username": "Required - Your Discord username for team communication (e.g., username#1234)", | ||
| # "instagram_username": "Instagram username without @ (e.g., username)", | ||
| # "bluesky_username": "Bluesky username (e.g., username or username.bsky.social)", | ||
| # "mastodon_url": "Mastodon handle (e.g., @[email protected] or https://instance.tld/@username)", | ||
| # "x_username": "X/Twitter username without @ (e.g., username)", | ||
| # "linkedin_url": "LinkedIn URL (e.g., linkedin.com/in/username)", | ||
| "region": "Region where you normally reside", | ||
| } | ||
|
|
||
| def clean(self): | ||
| cleaned_data = super().clean() | ||
| return cleaned_data | ||
|
|
||
| def __init__(self, *args, **kwargs): | ||
| self.user = kwargs.pop("user", None) | ||
| super().__init__(*args, **kwargs) | ||
|
|
||
| sorted_languages = sorted(LANGUAGES, key=lambda x: x[1]) | ||
|
|
||
| self.fields["discord_username"].required = True | ||
| self.fields["languages_spoken"].choices = sorted_languages | ||
| self.fields["languages_spoken"].widget = LanguageSelectMultiple( | ||
| choices=sorted_languages | ||
| ) | ||
|
|
||
| if self.instance and self.instance.pk: | ||
| pass | ||
|
|
||
| def save(self, commit=True): | ||
| if self.user: | ||
| self.instance.user = self.user | ||
| volunteer_profile = super().save(commit) | ||
| return volunteer_profile |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VolunteerConfig needs renamed