Add initial fossy app

This commit is contained in:
Ben Sturmfels 2023-01-27 19:49:25 +11:00
parent d43fd1de15
commit 6cb46c61d1
15 changed files with 230 additions and 1 deletions

View file

@ -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'),
),
]

View file

View file

@ -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

View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class FOSSYConfig(AppConfig):
name = 'fossy'

View file

@ -0,0 +1,9 @@
from django import forms
from .models import CommunityTrackProposal
class CommunityTrackProposalForm(forms.ModelForm):
class Meta:
model = CommunityTrackProposal
exclude = []

View file

@ -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')),
],
),
]

View file

@ -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')

View file

@ -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<pk>[\w-]+)/$', CommunityTrackProposalThanksView.as_view(), name='fossy-thanks'),
]

View file

@ -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

View file

@ -98,4 +98,5 @@ INSTALLED_APPS = [
'conservancy.apps.supporters',
'conservancy.apps.fundgoal',
'conservancy.apps.assignment',
'conservancy.apps.fossy',
]

View file

@ -0,0 +1,36 @@
{% extends "base_conservancy.html" %}
{% block category %}FOSSY{% endblock %}
{% block head %}
{{ block.super }}
<style>
label { display: block; }
input[type=text], input[type=email], input[type=date], select {
padding: 0.25rem;
}
input[type=checkbox] { width: auto; }
span[class=helptext] {
display: block;
font-size: 12px;
font-style: italic;
color: #666;
}
textarea {
width: 100%;
max-width: 45rem;
height: 8rem;
padding: 0.25rem;
}
#id_track_name, #id_contact_name, #id_contact_email {
width: 100%;
max-width: 25rem;
}
.helptext {
max-width: 35rem;
}
.errorlist {
margin: 1rem 0 0.25rem;
color: #e7040f;
white-space: pre-wrap;
}
</style>
{% endblock %}

View file

@ -0,0 +1,19 @@
{% extends 'fossy/base.html' %}
{% block outercontent %}
<h1><abbr title="Free and Open Source Software Yearly">FOSSY</abbr>: Propose a Commmunity Track!</h1>
<div class="mw7 mb5">
<p>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 <a href="mailto:conference@sfconservancy.org">conference@sfconservancy.org</a>.</p>
<form action="." method="post" class="mw7">
{% csrf_token %}
{% if form.errors %}
<p class="dark-red bg-washed-red pa2 ba b--red br1">Please review the errors below.</p>
{% endif %}
{{ form.as_p }}
<p><button type="submit" class="ph3 pv2">Submit</button></p>
</form>
</div>
{% endblock %}

View file

@ -0,0 +1,26 @@
{% extends 'fossy/base.html' %}
{% load static %}
{% block head %}
{{ block.super }}
<style>
input, select, textarea {
border: none;
padding: 0 !important;
}
.helptext {
display: none !important;
}
</style>
{% endblock %}
{% block outercontent %}
<h1>Thanks! <svg style="color: #ff41b4; width: 30px; height: 30px; vertical-align: middle;"><use href="{% static 'img/font_awesome.svg' %}#heart"></use></svg></h1>
<div class="mw7 mb5">
<p>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 <a href="mailto:conference@sfconservancy.org">conference@sfconservancy.org</a>.</p>
<form>
{{ form.as_p }}
</form>
</div>
{% endblock %}

View file

@ -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')),
]