diff --git a/www/conservancy/apps/fundgoal/admin.py b/www/conservancy/apps/fundgoal/admin.py index 054e46ab..c5f36715 100644 --- a/www/conservancy/apps/fundgoal/admin.py +++ b/www/conservancy/apps/fundgoal/admin.py @@ -1,7 +1,14 @@ from django.contrib import admin -from conservancy.apps.fundgoal.models import FundraisingGoal +from conservancy.apps.fundgoal import models as fundgoal_models class FundraisingGoalAdmin(admin.ModelAdmin): list_display = ('fundraiser_code_name', 'fundraiser_goal_amount') -admin.site.register(FundraisingGoal, FundraisingGoalAdmin) +class GoalProviderAdmin(admin.ModelAdmin): + fields = [ + 'fundraising_goal', + 'provider_name', + ] + +admin.site.register(fundgoal_models.FundraisingGoal, FundraisingGoalAdmin) +admin.site.register(fundgoal_models.GoalProvider, GoalProviderAdmin) diff --git a/www/conservancy/apps/fundgoal/migrations/0001_initial.py b/www/conservancy/apps/fundgoal/migrations/0001_initial.py new file mode 100644 index 00000000..a4e20f15 --- /dev/null +++ b/www/conservancy/apps/fundgoal/migrations/0001_initial.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-11-18 12:09 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='FundraisingGoal', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('fundraiser_code_name', models.CharField(max_length=200, unique=True)), + ('fundraiser_goal_amount', models.DecimalField(decimal_places=2, max_digits=10)), + ('fundraiser_so_far_amount', models.DecimalField(decimal_places=2, max_digits=10)), + ('fundraiser_donation_count', models.IntegerField()), + ('fundraiser_donation_count_disclose_threshold', models.IntegerField()), + ], + options={ + 'ordering': ('fundraiser_code_name',), + }, + ), + ] diff --git a/www/conservancy/apps/fundgoal/migrations/0002_goalprovider.py b/www/conservancy/apps/fundgoal/migrations/0002_goalprovider.py new file mode 100644 index 00000000..b55bd14a --- /dev/null +++ b/www/conservancy/apps/fundgoal/migrations/0002_goalprovider.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.7 on 2018-11-18 12:11 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('fundgoal', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='GoalProvider', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('provider_name', models.CharField(max_length=512)), + ('fundraising_goal', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='fundgoal.FundraisingGoal')), + ], + ), + ] diff --git a/www/conservancy/apps/fundgoal/migrations/__init__.py b/www/conservancy/apps/fundgoal/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/www/conservancy/apps/fundgoal/models.py b/www/conservancy/apps/fundgoal/models.py index 704b7528..2bb5d6d7 100644 --- a/www/conservancy/apps/fundgoal/models.py +++ b/www/conservancy/apps/fundgoal/models.py @@ -1,5 +1,6 @@ +import random + from django.db import models -from decimal import * class FundraisingGoal(models.Model): """Conservancy fundraiser Goal""" @@ -14,7 +15,30 @@ class FundraisingGoal(models.Model): return self.fundraiser_code_name def percentage_there(self): - return (self.fundraiser_so_far_amount / self.fundraiser_goal_amount ) * Decimal('100.00') + return (self.fundraiser_so_far_amount / self.fundraiser_goal_amount ) * 100 class Meta: ordering = ('fundraiser_code_name',) + + def providers(self): + return GoalProvider.objects.filter(fundraising_goal=self) + + def random_providers(self, k=None): + providers = self.providers() + if not providers.exists(): + return None + elif k is None: + return random.choice(providers) + else: + return random.sample(providers, k) + + +class GoalProvider(models.Model): + fundraising_goal = models.ForeignKey( + 'FundraisingGoal', + on_delete=models.CASCADE, + ) + provider_name = models.CharField(max_length=512) + + def __unicode__(self): + return self.provider_name diff --git a/www/conservancy/local_context_processors.py b/www/conservancy/local_context_processors.py index 1b435937..afbd5955 100644 --- a/www/conservancy/local_context_processors.py +++ b/www/conservancy/local_context_processors.py @@ -9,7 +9,7 @@ def fundgoal_lookup(fundraiser_sought): return None def sitefundraiser(request): - return {'sitefundgoal': fundgoal_lookup('fy-2018-main-match') } + return {'sitefundgoal': fundgoal_lookup('cy2018-end-year-match') } if conservancy.settings.FORCE_CANONICAL_HOSTNAME: _HOST_URL_VAR = {'host_url': 'https://' + conservancy.settings.FORCE_CANONICAL_HOSTNAME} diff --git a/www/conservancy/static/img/2018-11_Molly-de-Blanc-match-announcement-poster.png b/www/conservancy/static/img/2018-11_Molly-de-Blanc-match-announcement-poster.png new file mode 100644 index 00000000..dc506d9b Binary files /dev/null and b/www/conservancy/static/img/2018-11_Molly-de-Blanc-match-announcement-poster.png differ diff --git a/www/conservancy/static/img/projects/racket.svg b/www/conservancy/static/img/projects/racket.svg new file mode 100644 index 00000000..4f64634f --- /dev/null +++ b/www/conservancy/static/img/projects/racket.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/conservancy/static/img/projects/xapian.png b/www/conservancy/static/img/projects/xapian.png new file mode 100644 index 00000000..fa58ef20 Binary files /dev/null and b/www/conservancy/static/img/projects/xapian.png differ diff --git a/www/conservancy/static/projects/current/index.html b/www/conservancy/static/projects/current/index.html index abc02d3c..fc430c68 100644 --- a/www/conservancy/static/projects/current/index.html +++ b/www/conservancy/static/projects/current/index.html @@ -579,6 +579,20 @@ to encode low level details into it. KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, server and embedded PowerPC, and S390 guests.

+

Racket

+ + + +
+ + + +
+ +

Racket is a general-purpose programming language as well as the world’s +first ecosystem for language-oriented programming. Make your dream language, +or use one of the dozens already available.

+

Reproducible Builds

@@ -797,4 +811,19 @@ development toolkit for porting Windows source code to Unix as well as a program loader, allowing many unmodified Windows programs to run on x86-based Unixes, including Linux, Mac OS X, FreeBSD, and Solaris.

+

Xapian

+ + + +
+ + + +
+ +

Xapian is a highly adaptable toolkit which allows developers to +easily add advanced indexing and search facilities to their own +applications. It has built-in support for several families of weighting +models and also supports a rich set of boolean query operators.

+ {% endblock %} diff --git a/www/conservancy/templates/base_conservancy.html b/www/conservancy/templates/base_conservancy.html index 51ca7c1f..080f4580 100644 --- a/www/conservancy/templates/base_conservancy.html +++ b/www/conservancy/templates/base_conservancy.html @@ -63,7 +63,7 @@ this_match_remaining: this_match_goal - this_match_so_far {% endcomment %} {% comment %} -{% if sitefundgoal and sitefundgoal.fundraiser_so_far_amount %} +{% if sitefundgoal %} {% with this_match_goal=sitefundgoal.fundraiser_goal_amount this_match_so_far=sitefundgoal.fundraiser_so_far_amount %} {% with this_match_remaining=this_match_goal|subtract:this_match_so_far %}
@@ -72,9 +72,11 @@ this_match_remaining: this_match_goal - this_match_so_far Thanks to {{ sitegoal.fundraiser_donation_count|intcomma }} Supporters we earned our full match! Help us go further to stand up for software freedom — sign up now! {% else %} - The next ${{ this_match_remaining|floatformat:0|intcomma }} of support we receive will be matched thanks to Private Internet Access and an anonymous donor! Support Conservancy today! + The next ${{ this_match_remaining|floatformat:0|intcomma }} of support we receive will be matched thanks to Private Internet Access and a group of generous donors, including {{ sitefundgoal.random_providers }}! Support Conservancy today! {% endif %}

+ +{% if sitefundgoal.fundraiser_so_far_amount %}
We've matched @@ -88,6 +90,8 @@ this_match_remaining: this_match_goal - this_match_so_far so far!
+{% endif %} +
{% endwith %} {% endwith %} diff --git a/www/manage.py b/www/manage.py new file mode 100755 index 00000000..764f1029 --- /dev/null +++ b/www/manage.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python + +import os +import sys + +if __name__ == "__main__": + www_path = os.path.abspath(os.path.dirname(sys.argv[0])) + if www_path not in sys.path: + sys.path.append(www_path) + + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conservancy.settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv)