File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,10 +12,12 @@ type ApiEvent = {
1212 startTime : string | null ;
1313 location : string ;
1414 cover_image : string | null ;
15+ workshop_link : string ;
1516} ;
1617
17- type UiEvent = Omit < ApiEvent , "cover_image" > & {
18+ type UiEvent = Omit < ApiEvent , "cover_image" | "workshop_link" > & {
1819 coverImage : string ;
20+ workshopLink : string ;
1921} ;
2022
2123/**
@@ -33,6 +35,7 @@ function transformApiEventToUiEvent(data: ApiEvent): UiEvent {
3335 return {
3436 ...data ,
3537 coverImage : data . cover_image ?? "/game_dev_club_logo.svg" ,
38+ workshopLink : data . workshop_link ,
3639 } ;
3740}
3841
Original file line number Diff line number Diff line change @@ -12,16 +12,19 @@ type ApiEvent = {
1212 startTime : string | null ;
1313 location : string ;
1414 cover_image : string | null ;
15+ workshop_link : string ;
1516} ;
1617
17- export type UiEvent = Omit < ApiEvent , "cover_image" > & {
18+ export type UiEvent = Omit < ApiEvent , "cover_image" | "workshop_link" > & {
1819 coverImage : string ;
20+ workshopLink : string ;
1921} ;
2022
2123function transformApiEventToUiEvent ( data : ApiEvent ) : UiEvent {
2224 return {
2325 ...data ,
2426 coverImage : data . cover_image ?? "/game_dev_club_logo.svg" ,
27+ workshopLink : data . workshop_link ,
2528 } ;
2629}
2730
Original file line number Diff line number Diff line change @@ -75,6 +75,19 @@ export default function EventPage() {
7575 < p className = "mt-4 max-w-lg text-base leading-relaxed" >
7676 { event . description }
7777 </ p >
78+ { event . workshopLink && (
79+ < p className = "mt-4 text-base" >
80+ Workshop link:
81+ < a
82+ href = { event . workshopLink }
83+ target = "_blank"
84+ rel = "noreferrer"
85+ className = "underline"
86+ >
87+ { event . workshopLink }
88+ </ a >
89+ </ p >
90+ ) }
7891 </ div >
7992 < div className = "lg:w-128 relative aspect-[4/3] w-full flex-shrink-0 overflow-hidden rounded-lg bg-gray-700 md:w-96" >
8093 < Image
Original file line number Diff line number Diff line change 1+ from django .db import migrations , models
2+
3+
4+ class Migration (migrations .Migration ):
5+
6+ dependencies = [
7+ ("game_dev" , "0014_merge_20260214_1420" ),
8+ ]
9+
10+ operations = [
11+ migrations .AddField (
12+ model_name = "event" ,
13+ name = "workshop_link" ,
14+ field = models .URLField (blank = True , max_length = 2083 ),
15+ ),
16+ ]
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ class Event(models.Model):
1919 publicationDate = models .DateField ()
2020 cover_image = models .ImageField (upload_to = "events/" , null = True )
2121 location = models .CharField (max_length = 256 )
22+ workshop_link = models .URLField (max_length = 2083 , blank = True )
2223
2324 def __str__ (self ):
2425 return self .name
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ class Meta:
1313 "publicationDate" ,
1414 "cover_image" ,
1515 "location" ,
16+ "workshop_link" ,
1617 ]
1718
1819
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ def setUp(self):
4646 publicationDate = self .pub_date ,
4747 cover_image = image_file ,
4848 location = "Ezone" ,
49+ workshop_link = "https://example.com/workshop" ,
4950 )
5051
5152 def test_publication_date_is_date (self ):
@@ -73,6 +74,10 @@ def test_event_datetime_matches(self):
7374 event = Event .objects .get (pk = self .event .pk )
7475 self .assertEqual (event .date , self .event_datetime )
7576
77+ def test_workshop_link_matches (self ):
78+ event = Event .objects .get (pk = self .event .pk )
79+ self .assertEqual (event .workshop_link , "https://example.com/workshop" )
80+
7681
7782class CommitteeModelTest (TestCase ):
7883 def setUp (self ):
You can’t perform that action at this time.
0 commit comments