Skip to content

Commit d1bf0fd

Browse files
committed
Add default tags, descriptions, and raw hex code input
1 parent c105746 commit d1bf0fd

File tree

4 files changed

+60
-1
lines changed

4 files changed

+60
-1
lines changed

pgcommitfest/commitfest/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ class MailThreadAttachmentAdmin(admin.ModelAdmin):
4444
class ColorInput(widgets.Input):
4545
"""
4646
A color picker widget.
47-
TODO: this will be natively available in Django 5.2.
4847
"""
4948

5049
input_type = "color"
50+
template_name = "color_input.html"
5151

5252

5353
class TagAdmin(admin.ModelAdmin):

pgcommitfest/commitfest/migrations/0013_tag_patch_tags.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,60 @@
55
import pgcommitfest.commitfest.models
66

77

8+
def add_initial_tags(apps, schema_editor):
9+
Tag = apps.get_model("commitfest", "Tag")
10+
Tag.objects.bulk_create(
11+
[
12+
Tag(name="bugfix", color="#a51d2d", description="Fixes a bug"),
13+
Tag(
14+
name="backport",
15+
color="#1a5fb4",
16+
description="Once merged should be backported to old branches",
17+
),
18+
Tag(
19+
name="missing-tests",
20+
color="#c66424",
21+
description="Author should add tests",
22+
),
23+
Tag(
24+
name="missing-docs",
25+
color="#c66424",
26+
description="Author should add documentation",
27+
),
28+
Tag(
29+
name="missing-benchmarks",
30+
color="#c66424",
31+
description="Author should do additional benchmarks",
32+
),
33+
Tag(
34+
name="help-user-testing",
35+
color="#07732e",
36+
description="Reviewers are requested to try out the patch and provide user feedback on behaviour UX/UI",
37+
),
38+
Tag(
39+
name="help-bikeshedding",
40+
color="#07732e",
41+
description="Reviewers are requested to propose or vote on stylistic changes like a user facing function name",
42+
),
43+
Tag(
44+
name="help-docs",
45+
color="#07732e",
46+
description="Reviewers are requested to help review or write documentation",
47+
),
48+
Tag(
49+
name="help-benchmarks",
50+
color="#07732e",
51+
description="Reviewers are requested to help discuss or do benchmarks and discuss performance impact",
52+
),
53+
Tag(
54+
name="good-first-review",
55+
color="#613583",
56+
description="An easy to review patch for a new reviewer",
57+
),
58+
]
59+
)
60+
61+
862
class Migration(migrations.Migration):
963
dependencies = [
1064
("commitfest", "0012_add_status_related_constraints"),
@@ -25,6 +79,7 @@ class Migration(migrations.Migration):
2579
),
2680
("name", models.CharField(max_length=50, unique=True)),
2781
("color", pgcommitfest.commitfest.models.ColorField(max_length=7)),
82+
("description", models.CharField(max_length=500)),
2883
],
2984
options={
3085
"ordering": ("name",),
@@ -37,4 +92,5 @@ class Migration(migrations.Migration):
3792
blank=True, related_name="patches", to="commitfest.tag"
3893
),
3994
),
95+
migrations.RunPython(add_initial_tags, migrations.RunPython.noop),
4096
]

pgcommitfest/commitfest/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ class Tag(models.Model):
317317

318318
name = models.CharField(max_length=50, unique=True)
319319
color = ColorField()
320+
description = models.CharField(max_length=500)
320321

321322
class Meta:
322323
ordering = ("name",)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
<input type="color" name="{{ widget.name }}" onchange="this.nextElementSibling.value = this.value" {% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} >
2+
<input type="text" minlength="7" maxlength="7" onchange="this.previousElementSibling.value = this.value" {% if widget.value != None %} value="{{ widget.value|stringformat:'s' }}"{% endif %}>

0 commit comments

Comments
 (0)