Skip to content

Commit

Permalink
fix(website): Members email cannot be null (#175)
Browse files Browse the repository at this point in the history
* Set mail address as nullable
Update admin form

* black and pylint
  • Loading branch information
ElodieENSTA authored Jan 17, 2024
1 parent 48b1419 commit 77c294e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
7 changes: 3 additions & 4 deletions backend/osmosewebsite/admin/team_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class TeamMemberAdmin(ModelAdmin):
"lastname",
"firstname",
"position",
"mail_address",
"is_former_member",
"level",
]
Expand All @@ -29,7 +28,6 @@ class TeamMemberAdmin(ModelAdmin):
"lastname",
"firstname",
"position",
"mail_address",
"picture",
"biography",
"is_former_member",
Expand All @@ -38,11 +36,12 @@ class TeamMemberAdmin(ModelAdmin):
},
),
(
"Links",
"Email & Links",
{
"fields": [
"research_gate_url",
"mail_address",
"personal_website_url",
"research_gate_url",
"github_url",
"linkedin_url",
]
Expand Down
4 changes: 2 additions & 2 deletions backend/osmosewebsite/management/commands/seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _create_team_members(self):
position=profile["job"],
biography="\n".join(fake.paragraphs(5)),
picture=f"https://api.dicebear.com/7.x/identicon/svg?seed={profile['name']}",
mail_address=profile["mail"],
mail_address=profile["mail"] if random.randint(0, 1) > 0 else None,
research_gate_url=websites[0] if len(websites) > 0 else None,
personal_website_url=websites[1] if len(websites) > 1 else None,
github_url=websites[2] if len(websites) > 2 else None,
Expand All @@ -76,7 +76,7 @@ def _create_team_members(self):
position=profile["job"],
biography="\n".join(fake.paragraphs(5)),
picture=f"https://api.dicebear.com/7.x/identicon/svg?seed={profile['name']}",
mail_address=profile["mail"],
mail_address=profile["mail"] if random.randint(0, 1) > 0 else None,
research_gate_url=websites[0] if len(websites) > 0 else None,
personal_website_url=websites[1] if len(websites) > 1 else None,
github_url=websites[2] if len(websites) > 2 else None,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 3.2.23 on 2024-01-17 11:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("osmosewebsite", "0015_merge_20240108_1547"),
]

operations = [
migrations.AlterField(
model_name="teammember",
name="mail_address",
field=models.EmailField(
blank=True, max_length=254, null=True, verbose_name="Mail address"
),
),
]
2 changes: 1 addition & 1 deletion backend/osmosewebsite/models/team_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class TeamMember(models.Model):
biography = models.TextField()
picture = models.URLField()

mail_address = models.EmailField("Mail address")
mail_address = models.EmailField("Mail address", blank=True, null=True)
research_gate_url = models.URLField("Research Gate URL", blank=True, null=True)
personal_website_url = models.URLField(
"Personal website URL", blank=True, null=True
Expand Down
2 changes: 1 addition & 1 deletion website/src/models/team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface TeamMember {
biography: string;
picture: string;

mail_address: string;
mail_address?: string;

research_gate_url?: string;
personal_website_url?: string;
Expand Down

0 comments on commit 77c294e

Please sign in to comment.