forked from jayesh92/vms
-
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.
* Testing volunteer app * Add docstrings to tests
- Loading branch information
1 parent
70e1450
commit d1f77a5
Showing
14 changed files
with
985 additions
and
558 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ env: | |
- MOZ_HEADLESS=1 | ||
|
||
addons: | ||
firefox: "55.0" | ||
firefox: "60.0" | ||
|
||
python: | ||
- "3.6.5" | ||
|
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
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,100 +1,101 @@ | ||
# Django | ||
from django.contrib.auth.models import User | ||
from django.core.validators import (RegexValidator, MaxValueValidator, | ||
MinValueValidator) | ||
from django.db import models | ||
|
||
# local Django | ||
from organization.models import Organization | ||
|
||
|
||
class Volunteer(models.Model): | ||
id = models.AutoField(primary_key=True) | ||
first_name = models.CharField( | ||
max_length=30, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
last_name = models.CharField( | ||
max_length=30, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
address = models.CharField( | ||
max_length=75, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(0-9)|(\s)|(\-)|(\.)|(,)|(\:)]+$', ), | ||
], | ||
) | ||
city = models.CharField( | ||
max_length=75, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
state = models.CharField( | ||
max_length=50, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
country = models.CharField( | ||
max_length=75, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
phone_number = models.CharField( | ||
max_length=20, | ||
validators=[ | ||
RegexValidator( | ||
r'^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$', | ||
message="Please enter a valid phone number", | ||
), | ||
], | ||
) | ||
unlisted_organization = models.CharField( | ||
blank=True, | ||
max_length=100, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(0-9)|(\s)|(\-)|(:)]+$', ), | ||
], | ||
) | ||
# Organization to Volunteer is a one-to-many relationship | ||
organization = models.ForeignKey(Organization, null=True) | ||
# EmailField automatically checks if email address is a valid format | ||
email = models.EmailField(max_length=45, unique=True) | ||
websites = models.TextField( | ||
blank=True, | ||
validators=[ | ||
RegexValidator( | ||
r'^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9]\.[^\s]{2,})+$', | ||
), | ||
], | ||
) | ||
description = models.TextField( | ||
blank=True, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(0-9)|(\s)|(\.)|(,)|(\-)|(!)]+$', ), | ||
], | ||
) | ||
resume = models.TextField( | ||
blank=True, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(0-9)|(\s)|(\.)|(,)|(\-)|(!)]+$', ), | ||
], | ||
) | ||
# all resumes are stored in /srv/vms/resume/ | ||
resume_file = models.FileField( | ||
upload_to='vms/resume/', max_length=75, blank=True) | ||
reminder_days = models.IntegerField( | ||
default=1, | ||
validators=[MaxValueValidator(50), | ||
MinValueValidator(1)], | ||
blank=True) | ||
|
||
user = models.OneToOneField(User) | ||
def __str__(self): | ||
return '{0} {1}'.format(self.first_name, self.last_name) | ||
# Django | ||
from django.contrib.auth.models import User | ||
from django.core.validators import (RegexValidator, MaxValueValidator, | ||
MinValueValidator) | ||
from django.db import models | ||
|
||
# local Django | ||
from organization.models import Organization | ||
|
||
|
||
class Volunteer(models.Model): | ||
id = models.AutoField(primary_key=True) | ||
first_name = models.CharField( | ||
max_length=30, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
last_name = models.CharField( | ||
max_length=30, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
address = models.CharField( | ||
max_length=75, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(0-9)|(\s)|(\-)|(\.)|(,)|(\:)]+$', ), | ||
], | ||
) | ||
city = models.CharField( | ||
max_length=75, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
state = models.CharField( | ||
max_length=50, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
country = models.CharField( | ||
max_length=75, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(\s)|(\-)]+$', ), | ||
], | ||
) | ||
phone_number = models.CharField( | ||
max_length=20, | ||
validators=[ | ||
RegexValidator( | ||
r'^\s*(?:\+?(\d{1,3}))?([-. (]*(\d{3})[-. )]*)?((\d{3})[-. ]*(\d{2,4})(?:[-.x ]*(\d+))?)\s*$', | ||
message="Please enter a valid phone number", | ||
), | ||
], | ||
) | ||
unlisted_organization = models.CharField( | ||
blank=True, | ||
max_length=100, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(0-9)|(\s)|(\-)|(:)]+$', ), | ||
], | ||
) | ||
# Organization to Volunteer is a one-to-many relationship | ||
organization = models.ForeignKey(Organization, null=True) | ||
# EmailField automatically checks if email address is a valid format | ||
email = models.EmailField(max_length=45, unique=True) | ||
websites = models.TextField( | ||
blank=True, | ||
validators=[ | ||
RegexValidator( | ||
r'^(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9]\.[^\s]{2,})+$', | ||
), | ||
], | ||
) | ||
description = models.TextField( | ||
blank=True, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(0-9)|(\s)|(\.)|(,)|(\-)|(!)]+$', ), | ||
], | ||
) | ||
resume = models.TextField( | ||
blank=True, | ||
validators=[ | ||
RegexValidator(r'^[(A-Z)|(a-z)|(0-9)|(\s)|(\.)|(,)|(\-)|(!)]+$', ), | ||
], | ||
) | ||
# all resumes are stored in /srv/vms/resume/ | ||
resume_file = models.FileField( | ||
upload_to='vms/resume/', max_length=75, blank=True) | ||
reminder_days = models.IntegerField( | ||
default=1, | ||
validators=[MaxValueValidator(50), | ||
MinValueValidator(1)], | ||
blank=True) | ||
|
||
user = models.OneToOneField(User) | ||
|
||
def __str__(self): | ||
return '{0} {1}'.format(self.first_name, self.last_name) |
Oops, something went wrong.