-
Notifications
You must be signed in to change notification settings - Fork 50
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 #144 from volunteer-planner/release/2.0.0
Release 2.0.0
- Loading branch information
Showing
546 changed files
with
22,241 additions
and
85,635 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 |
---|---|---|
|
@@ -9,4 +9,6 @@ manlocal.py | |
db.sqlite3 | ||
.DS_Store | ||
*.mo | ||
/htmlcov | ||
/.coverage | ||
*.log |
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,7 +1,7 @@ | ||
language: python | ||
python: "2.7" | ||
before_install: | ||
- sudo apt-get update && sudo apt-get --reinstall install -qq language-pack-en language-pack-de | ||
install: "pip install -r requirements/dev.txt" | ||
env: DJANGO_SETTINGS_MODULE=volunteer_planner.settings.local | ||
script: py.test --create-db tests/ | ||
notifications: | ||
email: false |
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,9 @@ | ||
[main] | ||
host = https://www.transifex.com | ||
|
||
[volunteer-planner.django] | ||
file_filter = locale/<lang>/LC_MESSAGES/django.po | ||
source_file = locale/en/LC_MESSAGES/django.po | ||
source_lang = en | ||
type = PO | ||
|
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
File renamed without changes.
File renamed without changes.
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,3 +1,23 @@ | ||
# coding: utf-8 | ||
|
||
from django.conf import settings | ||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
from registration.signals import user_activated | ||
from django.dispatch import receiver | ||
|
||
|
||
class UserAccount(models.Model): | ||
user = models.OneToOneField(settings.AUTH_USER_MODEL, | ||
related_name='account') | ||
|
||
class Meta: | ||
verbose_name = _('user account') | ||
verbose_name_plural = _('user accounts') | ||
|
||
@receiver(user_activated) | ||
def registration_completed(sender, user, request, **kwargs): | ||
account, created = UserAccount.objects.get_or_create(user=user) | ||
print account, created | ||
|
||
|
||
# Create your models here. |
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 was deleted.
Oops, something went wrong.
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,46 @@ | ||
# coding: utf-8 | ||
|
||
from datetime import timedelta | ||
|
||
from django import template | ||
from django.contrib.auth.models import User | ||
from django.db.models import Count | ||
from django.utils import timezone | ||
|
||
from scheduler.models import Need, Location | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.assignment_tag | ||
def get_facility_count(): | ||
return Location.objects.filter().count() | ||
|
||
|
||
@register.assignment_tag | ||
def get_volunteer_number(): | ||
return User.objects.filter(is_active=True).count() | ||
|
||
|
||
@register.assignment_tag | ||
def get_volunteer_hours(): | ||
""" | ||
Returns the number of total volunteer hours worked. | ||
""" | ||
finished_needs = Need.objects.filter( | ||
starting_time__lte=timezone.now()).annotate( | ||
slots_done=Count('helpers')) | ||
delta = timedelta() | ||
for need in finished_needs: | ||
delta += need.slots_done * (need.ending_time - need.starting_time) | ||
hours = int(delta.total_seconds() / 3600) | ||
return hours | ||
|
||
|
||
@register.assignment_tag | ||
def get_volunteer_stats(): | ||
return { | ||
'volunteer_count': get_volunteer_number(), | ||
'facility_count': get_facility_count(), | ||
'volunteer_hours': get_volunteer_hours(), | ||
} |
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,51 @@ | ||
# coding: utf-8 | ||
|
||
from numbers import Number | ||
|
||
from django import template | ||
|
||
register = template.Library() | ||
|
||
|
||
@register.filter | ||
def subtract(lhs, rhs): | ||
rhs = int(rhs) if not isinstance(rhs, Number) else rhs | ||
lhs = int(lhs) if not isinstance(lhs, Number) else lhs | ||
return rhs - lhs | ||
|
||
|
||
@register.filter | ||
def divide(lhs, rhs): | ||
lhs = float(lhs) if not isinstance(lhs, Number) else lhs | ||
rhs = float(rhs) if not isinstance(rhs, Number) else rhs | ||
return lhs / rhs if rhs else None | ||
|
||
|
||
@register.filter | ||
def contains(enumeratable, obj): | ||
return obj in enumeratable | ||
|
||
|
||
@register.filter | ||
def split(value, separator=' '): | ||
return value.split(separator) | ||
|
||
|
||
@register.filter | ||
def eq(lhs, rhs): | ||
return lhs == rhs | ||
|
||
|
||
@register.filter | ||
def neq(lhs, rhs): | ||
return lhs != rhs | ||
|
||
|
||
@register.filter | ||
def yes(lhs, rhs, default=""): | ||
return rhs if lhs else default | ||
|
||
|
||
@register.filter | ||
def no(lhs, rhs, default=""): | ||
return rhs if not lhs else default |
Oops, something went wrong.