Skip to content

Commit 2fd85e7

Browse files
committed
fix: name is nullable
1 parent 111d5f5 commit 2fd85e7

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.2.25 on 2025-01-10 18:34
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('api', '0001_initial'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='contributor',
15+
name='name',
16+
field=models.TextField(null=True, verbose_name='name'),
17+
),
18+
]

api/models/contributor.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class Contributor(AbstractBaseUser):
4040
id = models.IntegerField(
4141
primary_key=True, help_text=_("The contributor's GitHub user-ID.")
4242
)
43-
name = models.TextField(_("name"))
43+
name = models.TextField(_("name"), null=True)
4444
location = models.TextField(_("location"), null=True)
4545
html_url = models.TextField(_("html url"))
4646
avatar_url = models.TextField(_("avatar url"))
@@ -129,7 +129,7 @@ def sync_with_github(cls, auth: str):
129129
except Contributor.DoesNotExist:
130130
contributor = Contributor(id=github_user["id"])
131131

132-
contributor.name = github_user["name"]
132+
contributor.name = github_user.get("name")
133133
contributor.location = github_user.get("location")
134134
contributor.html_url = github_user["html_url"]
135135
contributor.avatar_url = github_user["avatar_url"]

settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
© Ocado Group
3-
Created on 04/07/2024 at 11:42:01(+01:00).
3+
Created on 04/07/2024 at 11:42:00(+01:00).
44
55
Django settings for api.
66

0 commit comments

Comments
 (0)