Skip to content

Commit 0890b27

Browse files
JacobCoffeeclaude
andcommitted
Restore null=True on all string fields to avoid unintended schema changes
Ruff DJ001 removed null=True from ~30 string-based model fields, but this changes the DB schema and requires migrations + data handling. Restore null=True with noqa: DJ001 to keep this as a formatting-only PR. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 1c8d6d2 commit 0890b27

9 files changed

Lines changed: 34 additions & 31 deletions

File tree

community/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
class Post(ContentManageable):
1616
"""A community post that can contain text, photos, videos, or links."""
1717

18-
title = models.CharField(max_length=200, blank=True)
18+
title = models.CharField(max_length=200, blank=True, null=True) # noqa: DJ001
1919
content = MarkupField(default_markup_type=DEFAULT_MARKUP_TYPE)
20-
abstract = models.TextField(blank=True)
20+
abstract = models.TextField(blank=True, null=True) # noqa: DJ001
2121

2222
MEDIA_TEXT = 1
2323
MEDIA_PHOTO = 2

events/models.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
class Calendar(ContentManageable):
2525
"""A calendar that groups related events (e.g. conferences, user groups)."""
2626

27-
url = models.URLField("URL iCal", blank=True)
28-
rss = models.URLField("RSS Feed", blank=True)
29-
embed = models.URLField("URL embed", blank=True)
30-
twitter = models.URLField("Twitter feed", blank=True)
27+
url = models.URLField("URL iCal", blank=True, null=True) # noqa: DJ001
28+
rss = models.URLField("RSS Feed", blank=True, null=True) # noqa: DJ001
29+
embed = models.URLField("URL embed", blank=True, null=True) # noqa: DJ001
30+
twitter = models.URLField("Twitter feed", blank=True, null=True) # noqa: DJ001
3131
name = models.CharField(max_length=100)
3232
slug = models.SlugField(unique=True)
33-
description = models.CharField(max_length=255, blank=True)
33+
description = models.CharField(max_length=255, null=True, blank=True) # noqa: DJ001
3434

3535
def __str__(self):
3636
"""Return string representation."""
@@ -85,8 +85,8 @@ class EventLocation(models.Model):
8585
)
8686

8787
name = models.CharField(max_length=255)
88-
address = models.CharField(blank=True, max_length=255)
89-
url = models.URLField("URL", blank=True)
88+
address = models.CharField(blank=True, null=True, max_length=255) # noqa: DJ001
89+
url = models.URLField("URL", blank=True, null=True) # noqa: DJ001
9090

9191
class Meta:
9292
"""Meta configuration for EventLocation."""
@@ -119,7 +119,7 @@ def until_datetime(self, dt=None):
119119
class Event(ContentManageable):
120120
"""A Python community event such as a conference, sprint, or meetup."""
121121

122-
uid = models.CharField(max_length=200, blank=True)
122+
uid = models.CharField(max_length=200, null=True, blank=True) # noqa: DJ001
123123
title = models.CharField(max_length=200)
124124
calendar = models.ForeignKey(Calendar, related_name="events", on_delete=models.CASCADE)
125125

jobs/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class Job(ContentManageable):
7373
max_length=100,
7474
blank=True,
7575
)
76-
company_name = models.CharField(max_length=100)
76+
company_name = models.CharField(max_length=100, null=True) # noqa: DJ001
7777
company_description = MarkupField(blank=True, default_markup_type=DEFAULT_MARKUP_TYPE)
7878
job_title = models.CharField(max_length=100)
7979

@@ -86,9 +86,9 @@ class Job(ContentManageable):
8686
description = MarkupField(verbose_name="Job description", default_markup_type=DEFAULT_MARKUP_TYPE)
8787
requirements = MarkupField(verbose_name="Job requirements", default_markup_type=DEFAULT_MARKUP_TYPE)
8888

89-
contact = models.CharField(verbose_name="Contact name", blank=True, max_length=100)
89+
contact = models.CharField(verbose_name="Contact name", null=True, blank=True, max_length=100) # noqa: DJ001
9090
email = models.EmailField(verbose_name="Contact email")
91-
url = models.URLField(verbose_name="URL", blank=False)
91+
url = models.URLField(verbose_name="URL", null=True, blank=False) # noqa: DJ001
9292

9393
submitted_by = models.ForeignKey(
9494
User,

nominations/models.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Election(models.Model):
2323
nominations_close_at = models.DateTimeField(blank=True, null=True)
2424
description = MarkupField(escape_html=False, markup_type="markdown", blank=False, null=True)
2525

26-
slug = models.SlugField(max_length=255, blank=True)
26+
slug = models.SlugField(max_length=255, blank=True, null=True) # noqa: DJ001
2727

2828
class Meta:
2929
"""Meta configuration for Election."""
@@ -86,7 +86,7 @@ class Nominee(models.Model):
8686
accepted = models.BooleanField(null=False, default=False)
8787
approved = models.BooleanField(null=False, default=False)
8888

89-
slug = models.SlugField(max_length=255, blank=True)
89+
slug = models.SlugField(max_length=255, blank=True, null=True) # noqa: DJ001
9090

9191
class Meta:
9292
"""Meta configuration for Nominee."""
@@ -174,11 +174,11 @@ class Nomination(models.Model):
174174

175175
election = models.ForeignKey(Election, on_delete=models.CASCADE)
176176

177-
name = models.CharField(max_length=1024, blank=False)
178-
email = models.CharField(max_length=1024, blank=False)
179-
previous_board_service = models.CharField(max_length=1024, blank=False)
180-
employer = models.CharField(max_length=1024, blank=False)
181-
other_affiliations = models.CharField(max_length=2048, blank=True)
177+
name = models.CharField(max_length=1024, blank=False, null=True) # noqa: DJ001
178+
email = models.CharField(max_length=1024, blank=False, null=True) # noqa: DJ001
179+
previous_board_service = models.CharField(max_length=1024, blank=False, null=True) # noqa: DJ001
180+
employer = models.CharField(max_length=1024, blank=False, null=True) # noqa: DJ001
181+
other_affiliations = models.CharField(max_length=2048, blank=True, null=True) # noqa: DJ001
182182
nomination_statement = MarkupField(escape_html=True, markup_type="markdown", blank=False, null=True)
183183

184184
nominator = models.ForeignKey(User, related_name="nominations_made", on_delete=models.CASCADE)

sponsors/models/assets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def choices(cls):
185185
class ResponseAsset(GenericAsset):
186186
"""Asset storing a yes/no response value."""
187187

188-
response = models.CharField(max_length=32, choices=Response.choices(), blank=False)
188+
response = models.CharField(max_length=32, choices=Response.choices(), blank=False, null=True) # noqa: DJ001
189189

190190
def __str__(self):
191191
"""Return string representation."""

sponsors/models/benefits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ class BaseProvidedTextAsset(BaseProvidedAsset):
243243
help_text = models.CharField(
244244
max_length=256, help_text="Any helper comment on how the input should be populated", default="", blank=True
245245
)
246-
shared_text = models.TextField(blank=True)
246+
shared_text = models.TextField(blank=True, null=True) # noqa: DJ001
247247

248248
class Meta(BaseProvidedAsset.Meta):
249249
"""Meta configuration for BaseProvidedTextAsset."""

sponsors/models/sponsors.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,21 @@ class Sponsor(ContentManageable):
2727
verbose_name="Description",
2828
help_text="Brief description of the sponsor for public display.",
2929
)
30-
landing_page_url = models.URLField(
30+
landing_page_url = models.URLField( # noqa: DJ001
3131
blank=True,
32+
null=True,
3233
verbose_name="Landing page URL",
3334
help_text="Landing page URL. This may be provided by the sponsor, however the linked page may not contain any "
3435
"sales or marketing information.",
3536
)
36-
twitter_handle = models.CharField(
37+
twitter_handle = models.CharField( # noqa: DJ001
3738
max_length=32, # Actual limit set by twitter is 15 characters, but that may change?
3839
blank=True,
40+
null=True,
3941
verbose_name="Twitter handle",
4042
)
41-
linked_in_page_url = models.URLField(
42-
blank=True, verbose_name="LinkedIn page URL", help_text="URL for your LinkedIn page."
43+
linked_in_page_url = models.URLField( # noqa: DJ001
44+
blank=True, null=True, verbose_name="LinkedIn page URL", help_text="URL for your LinkedIn page."
4345
)
4446
web_logo = models.ImageField(
4547
upload_to="sponsor_web_logos",
@@ -72,8 +74,8 @@ class Sponsor(ContentManageable):
7274
blank=True,
7375
null=True,
7476
)
75-
state_of_incorporation = models.CharField(
76-
verbose_name="US only: State of incorporation (If different)", max_length=64, blank=True, default=""
77+
state_of_incorporation = models.CharField( # noqa: DJ001
78+
verbose_name="US only: State of incorporation (If different)", max_length=64, blank=True, null=True, default=""
7779
)
7880

7981
class Meta:
@@ -210,7 +212,8 @@ class SponsorBenefit(OrderedModel):
210212
verbose_name="Benefit Name",
211213
help_text="For display in the contract and sponsor dashboard.",
212214
)
213-
description = models.TextField(
215+
description = models.TextField( # noqa: DJ001
216+
null=True,
214217
blank=True,
215218
verbose_name="Benefit Description",
216219
help_text="For display in the contract and sponsor dashboard.",

sponsors/models/sponsorship.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class SponsorshipProgram(OrderedModel):
133133
"""Possible programs that a benefit belongs to (Foundation, Pypi, etc)."""
134134

135135
name = models.CharField(max_length=64)
136-
description = models.TextField(blank=True)
136+
description = models.TextField(null=True, blank=True) # noqa: DJ001
137137

138138
class Meta(OrderedModel.Meta):
139139
"""Meta configuration for SponsorshipProgram."""

successstories/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Story(NameSlugModel, ContentManageable):
5757
on_delete=models.CASCADE,
5858
)
5959
author = models.CharField(max_length=500, help_text="Author of the content")
60-
author_email = models.EmailField(max_length=100, blank=True)
60+
author_email = models.EmailField(max_length=100, blank=True, null=True) # noqa: DJ001
6161
pull_quote = models.TextField()
6262
content = MarkupField(default_markup_type=DEFAULT_MARKUP_TYPE)
6363
is_published = models.BooleanField(default=False, db_index=True)

0 commit comments

Comments
 (0)