Skip to content

Commit

Permalink
Relate sponsorship benefits with legal clauses (#1695)
Browse files Browse the repository at this point in the history
  • Loading branch information
berinhard committed Dec 2, 2020
1 parent 30a94fc commit 72b6b8b
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 0 deletions.
7 changes: 7 additions & 0 deletions sponsors/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Sponsorship,
SponsorContact,
SponsorBenefit,
LegalClause,
)
from sponsors import use_cases
from sponsors.forms import SponsorshipReviewAdminForm
Expand Down Expand Up @@ -65,6 +66,7 @@ class SponsorshipBenefitAdmin(OrderedModelAdmin):
"internal_value",
"capacity",
"soft_capacity",
"legal_clauses",
"conflicts",
)
},
Expand Down Expand Up @@ -316,3 +318,8 @@ def approve_sponsorship_view(self, request, pk):
return render(
request, "sponsors/admin/approve_application.html", context=context
)


@admin.register(LegalClause)
class LegalClauseModelAdmin(OrderedModelAdmin):
list_display = ["internal_name"]
81 changes: 81 additions & 0 deletions sponsors/migrations/0018_auto_20201201_1659.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Generated by Django 2.0.13 on 2020-12-01 16:59

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("sponsors", "0017_sponsorbenefit_added_by_user"),
]

operations = [
migrations.CreateModel(
name="LegalClause",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"order",
models.PositiveIntegerField(
db_index=True, editable=False, verbose_name="order"
),
),
(
"internal_name",
models.CharField(
help_text="Friendly name used internally by PSF to reference this clause",
max_length=1024,
verbose_name="Internal Name",
),
),
(
"clause",
models.TextField(
help_text="Legal clause text to be added to statement of work",
verbose_name="Clause",
),
),
(
"notes",
models.TextField(
blank=True,
default="",
help_text="PSF staff notes",
verbose_name="Notes",
),
),
],
options={
"ordering": ("order",),
"abstract": False,
},
),
migrations.AlterField(
model_name="sponsorshipbenefit",
name="package_only",
field=models.BooleanField(
default=False,
help_text="If a benefit is only available via a sponsorship package, select this option.",
verbose_name="Sponsor Package Only Benefit",
),
),
migrations.AddField(
model_name="sponsorshipbenefit",
name="legal_clauses",
field=models.ManyToManyField(
blank=True,
help_text="Legal clauses to be displayed in the statement of work",
related_name="benefits",
to="sponsors.LegalClause",
verbose_name="Legal Clauses",
),
),
]
30 changes: 30 additions & 0 deletions sponsors/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ class SponsorshipBenefit(OrderedModel):
)

# Internal
legal_clauses = models.ManyToManyField(
"LegalClause",
related_name="benefits",
verbose_name="Legal Clauses",
help_text="Legal clauses to be displayed in the statement of work",
blank=True,
)
internal_description = models.TextField(
null=True,
blank=True,
Expand Down Expand Up @@ -438,3 +445,26 @@ def verified_emails(self, initial_emails=None):

def __str__(self):
return f"{self.name}"


class LegalClause(OrderedModel):
internal_name = models.CharField(
max_length=1024,
verbose_name="Internal Name",
help_text="Friendly name used internally by PSF to reference this clause",
blank=False,
)
clause = models.TextField(
verbose_name="Clause",
help_text="Legal clause text to be added to statement of work",
blank=False,
)
notes = models.TextField(
verbose_name="Notes", help_text="PSF staff notes", blank=True, default=""
)

def __str__(self):
return f"Clause: {self.internal_name}"

class Meta(OrderedModel.Meta):
pass

0 comments on commit 72b6b8b

Please sign in to comment.