From 6cb46c61d163f0041476e3cda01e2c4a2533123d Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Fri, 27 Jan 2023 19:49:25 +1100 Subject: [PATCH] Add initial fossy app --- .../migrations/0004_auto_20230127_0602.py | 31 ++++++++++++++ www/conservancy/apps/fossy/__init__.py | 0 www/conservancy/apps/fossy/admin.py | 9 +++++ www/conservancy/apps/fossy/apps.py | 5 +++ www/conservancy/apps/fossy/forms.py | 9 +++++ .../apps/fossy/migrations/0001_initial.py | 28 +++++++++++++ .../apps/fossy/migrations/__init__.py | 0 www/conservancy/apps/fossy/models.py | 15 +++++++ www/conservancy/apps/fossy/urls.py | 9 +++++ www/conservancy/apps/fossy/views.py | 40 +++++++++++++++++++ www/conservancy/settings.py | 1 + www/conservancy/templates/fossy/base.html | 36 +++++++++++++++++ .../fossy/community_track_proposal_form.html | 19 +++++++++ www/conservancy/templates/fossy/thanks.html | 26 ++++++++++++ www/conservancy/urls.py | 3 +- 15 files changed, 230 insertions(+), 1 deletion(-) create mode 100644 www/conservancy/apps/assignment/migrations/0004_auto_20230127_0602.py create mode 100644 www/conservancy/apps/fossy/__init__.py create mode 100644 www/conservancy/apps/fossy/admin.py create mode 100644 www/conservancy/apps/fossy/apps.py create mode 100644 www/conservancy/apps/fossy/forms.py create mode 100644 www/conservancy/apps/fossy/migrations/0001_initial.py create mode 100644 www/conservancy/apps/fossy/migrations/__init__.py create mode 100644 www/conservancy/apps/fossy/models.py create mode 100644 www/conservancy/apps/fossy/urls.py create mode 100644 www/conservancy/apps/fossy/views.py create mode 100644 www/conservancy/templates/fossy/base.html create mode 100644 www/conservancy/templates/fossy/community_track_proposal_form.html create mode 100644 www/conservancy/templates/fossy/thanks.html diff --git a/www/conservancy/apps/assignment/migrations/0004_auto_20230127_0602.py b/www/conservancy/apps/assignment/migrations/0004_auto_20230127_0602.py new file mode 100644 index 00000000..f44142cb --- /dev/null +++ b/www/conservancy/apps/assignment/migrations/0004_auto_20230127_0602.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.29 on 2023-01-27 06:02 +from __future__ import unicode_literals + +import conservancy.apps.assignment.models +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('assignment', '0003_auto_20211206_2249'), + ] + + operations = [ + migrations.AlterField( + model_name='assignment', + name='all_emails', + field=models.TextField(verbose_name='All email addresses or other unique user identities, such as nicknames or handles, used by you to contribute to the above (i.e. in the commit logs)'), + ), + migrations.AlterField( + model_name='assignment', + name='attestation_of_copyright', + field=models.BooleanField(verbose_name='By checking the box below, I am confirming that I agree to be bound by the terms of the Copyright Assignment Agreement above.'), + ), + migrations.AlterField( + model_name='assignment', + name='repositories', + field=models.TextField(help_text='List of URLs, one per line', validators=[conservancy.apps.assignment.models.validate_mutiple_urls], verbose_name='Code repositories containing contributions of yours whose copyright you are assigning'), + ), + ] diff --git a/www/conservancy/apps/fossy/__init__.py b/www/conservancy/apps/fossy/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/www/conservancy/apps/fossy/admin.py b/www/conservancy/apps/fossy/admin.py new file mode 100644 index 00000000..643d7c24 --- /dev/null +++ b/www/conservancy/apps/fossy/admin.py @@ -0,0 +1,9 @@ +from django.contrib import admin + +from .models import CommunityTrackProposal + + +@admin.register(CommunityTrackProposal) +class CommunityTrackProposalAdmin(admin.ModelAdmin): + list_display = ['track_name', 'contact_name'] + pass diff --git a/www/conservancy/apps/fossy/apps.py b/www/conservancy/apps/fossy/apps.py new file mode 100644 index 00000000..a11baabc --- /dev/null +++ b/www/conservancy/apps/fossy/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class FOSSYConfig(AppConfig): + name = 'fossy' diff --git a/www/conservancy/apps/fossy/forms.py b/www/conservancy/apps/fossy/forms.py new file mode 100644 index 00000000..8ef38f22 --- /dev/null +++ b/www/conservancy/apps/fossy/forms.py @@ -0,0 +1,9 @@ +from django import forms + +from .models import CommunityTrackProposal + + +class CommunityTrackProposalForm(forms.ModelForm): + class Meta: + model = CommunityTrackProposal + exclude = [] diff --git a/www/conservancy/apps/fossy/migrations/0001_initial.py b/www/conservancy/apps/fossy/migrations/0001_initial.py new file mode 100644 index 00000000..68f48e92 --- /dev/null +++ b/www/conservancy/apps/fossy/migrations/0001_initial.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.29 on 2023-01-27 06:19 +from __future__ import unicode_literals + +from django.db import migrations, models +import uuid + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='CommunityTrackProposal', + fields=[ + ('uuid', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('track_name', models.CharField(help_text='e.g. Time Travel with Free Software', max_length=255, verbose_name='Track name')), + ('contact_name', models.CharField(max_length=255, verbose_name='Contact name')), + ('contact_email', models.EmailField(max_length=254, verbose_name='Contact email')), + ('overview', models.TextField(help_text='Please provide several paragraphs outlining your topic, the target audience and suggested talk themes. If selected we will contact you for an extended track description.')), + ('organisers', models.TextField(help_text='Please include the names and job titles of yourself an any other organisers', verbose_name='List of organisers')), + ], + ), + ] diff --git a/www/conservancy/apps/fossy/migrations/__init__.py b/www/conservancy/apps/fossy/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/www/conservancy/apps/fossy/models.py b/www/conservancy/apps/fossy/models.py new file mode 100644 index 00000000..bb664961 --- /dev/null +++ b/www/conservancy/apps/fossy/models.py @@ -0,0 +1,15 @@ +import uuid + +from django.db import models + + +class CommunityTrackProposal(models.Model): + uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) + track_name = models.CharField('Track name', max_length=255, help_text='e.g. Time Travel with Free Software') + contact_name = models.CharField('Contact name', max_length=255) + contact_email = models.EmailField('Contact email') + overview = models.TextField( + help_text='Please provide several paragraphs outlining your topic, the target audience and suggested talk themes. If selected we will contact you for an extended track description.') + organisers = models.TextField( + 'List of organisers', + help_text='Please include the names and job titles of yourself an any other organisers') diff --git a/www/conservancy/apps/fossy/urls.py b/www/conservancy/apps/fossy/urls.py new file mode 100644 index 00000000..b26789ae --- /dev/null +++ b/www/conservancy/apps/fossy/urls.py @@ -0,0 +1,9 @@ +from django.conf.urls import url + +from .views import CommunityTrackProposalCreateView, CommunityTrackProposalThanksView + + +urlpatterns = [ + url(r'^community-tracks/$', CommunityTrackProposalCreateView.as_view(), name='fossy-add'), + url(r'^(?P[\w-]+)/$', CommunityTrackProposalThanksView.as_view(), name='fossy-thanks'), +] diff --git a/www/conservancy/apps/fossy/views.py b/www/conservancy/apps/fossy/views.py new file mode 100644 index 00000000..1660f7c6 --- /dev/null +++ b/www/conservancy/apps/fossy/views.py @@ -0,0 +1,40 @@ +from django.core.mail import send_mail +from django.urls import reverse_lazy +from django.views.generic import DetailView +from django.views.generic.edit import CreateView + +from .forms import CommunityTrackProposalForm +from .models import CommunityTrackProposal + + +class CommunityTrackProposalCreateView(CreateView): + """Show a form for accepting FOSSY community track proposals.""" + + form_class = CommunityTrackProposalForm + template_name = 'fossy/community_track_proposal_form.html' + + def form_valid(self, form): + intro = 'The following FOSSY community track proposal has been submitted:\n\n' + body = intro + '\n'.join(['{}: {}'.format(k, v) for k, v in form.cleaned_data.items() if k != 'agreement_terms']) + send_mail( + 'Community track proposal {}'.format(form.cleaned_data['track_name']), + body, + 'conference@sfconservancy.org', + ['conference@sfconservancy.org'], + ) + return super().form_valid(form) + + def get_success_url(self, *args, **kwargs): + return reverse_lazy('fossy-thanks', kwargs={'pk': str(self.object.uuid)}) + + +class CommunityTrackProposalThanksView(DetailView): + model = CommunityTrackProposal + template_name = 'fossy/thanks.html' + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context['form'] = CommunityTrackProposalForm(instance=self.object) + for _, field in context['form'].fields.items(): + field.widget.attrs['disabled'] = 'disabled' + return context diff --git a/www/conservancy/settings.py b/www/conservancy/settings.py index 774bc835..7d736283 100644 --- a/www/conservancy/settings.py +++ b/www/conservancy/settings.py @@ -98,4 +98,5 @@ INSTALLED_APPS = [ 'conservancy.apps.supporters', 'conservancy.apps.fundgoal', 'conservancy.apps.assignment', + 'conservancy.apps.fossy', ] diff --git a/www/conservancy/templates/fossy/base.html b/www/conservancy/templates/fossy/base.html new file mode 100644 index 00000000..e3dc2afa --- /dev/null +++ b/www/conservancy/templates/fossy/base.html @@ -0,0 +1,36 @@ +{% extends "base_conservancy.html" %} +{% block category %}FOSSY{% endblock %} +{% block head %} + {{ block.super }} + +{% endblock %} diff --git a/www/conservancy/templates/fossy/community_track_proposal_form.html b/www/conservancy/templates/fossy/community_track_proposal_form.html new file mode 100644 index 00000000..70866d6a --- /dev/null +++ b/www/conservancy/templates/fossy/community_track_proposal_form.html @@ -0,0 +1,19 @@ +{% extends 'fossy/base.html' %} +{% block outercontent %} +

FOSSY: Propose a Commmunity Track!

+
+

A large portion of FOSSY will be made up of community run tracks, similar to "DevRooms" at FOSDEM. We'd like to invite you to run a track based on a topic you're passionate about. If selected, you will be responsible for inviting speakers and selecting and scheduling talks for your track. If that sounds like you, please fill in the form to tell us more about your idea. If you have any questions please don't hesitate to email us at conference@sfconservancy.org.

+ +
+ {% csrf_token %} + + {% if form.errors %} +

Please review the errors below.

+ {% endif %} + + {{ form.as_p }} + +

+
+
+{% endblock %} diff --git a/www/conservancy/templates/fossy/thanks.html b/www/conservancy/templates/fossy/thanks.html new file mode 100644 index 00000000..0277500c --- /dev/null +++ b/www/conservancy/templates/fossy/thanks.html @@ -0,0 +1,26 @@ +{% extends 'fossy/base.html' %} +{% load static %} +{% block head %} + {{ block.super }} + + + +{% endblock %} +{% block outercontent %} +

Thanks!

+ +
+

Thanks very much for taking the time and effort to propose a community track. We'll get back to you as soon as we've selected the tracks. In the mean time if you have any questions, please email conference@sfconservancy.org.

+
+ {{ form.as_p }} +
+
+{% endblock %} diff --git a/www/conservancy/urls.py b/www/conservancy/urls.py index 6f5c4308..9836b05a 100644 --- a/www/conservancy/urls.py +++ b/www/conservancy/urls.py @@ -47,7 +47,6 @@ urlpatterns = [ url(r'^error/(40[134]|500)(?:/index\.html|/|)$', static_views.handler), url(r'^error', static_views.index), url(r'^about', static_views.index), - url(r'^fossy', static_views.index), url(r'^activities', static_views.index), url(r'^donate', static_views.index), url(r'^copyleft-compliance', static_views.index, @@ -66,4 +65,6 @@ urlpatterns = [ url(r'^fundraiser_data', fundgoal_views.view), url(r'^ccs-upload/', include('conservancy.apps.ccs_upload.urls', namespace='ccs_upload')), url(r'^assignment/', include('conservancy.apps.assignment.urls')), + url(r'^fossy/$', static_views.index), + url(r'^fossy/', include('conservancy.apps.fossy.urls')), ]