Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
08ad4c3
Added Jam model with automatic game population
Games4Doritos Feb 4, 2026
f278bd7
Reworked Game Jam model
Games4Doritos Feb 7, 2026
154c65d
Fixed migration error
Games4Doritos Feb 7, 2026
5aa944f
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 7, 2026
9b55dbd
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 7, 2026
8be24ee
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 8, 2026
ff1cb73
Refined save() and changed help_text
Games4Doritos Feb 8, 2026
fc747b8
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 11, 2026
161dac2
Linked individual game objects to their jam
Games4Doritos Feb 11, 2026
2232d56
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 13, 2026
4e570e1
Update poetry.lock
Games4Doritos Feb 13, 2026
0b17bc5
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 13, 2026
71f39fa
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 13, 2026
6c6f02d
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 14, 2026
e790e29
Added Game Contributor autofilling + ..
Games4Doritos Feb 14, 2026
4808fae
Fixed some spelling mistakes
Games4Doritos Feb 14, 2026
9923143
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 19, 2026
d6305d4
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 20, 2026
309507b
Minor Changes and migration refactor
Games4Doritos Feb 20, 2026
25835de
Added exception handling
Games4Doritos Feb 21, 2026
b008d2f
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 21, 2026
9cb0120
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 21, 2026
48a656c
Made Event object save itself first
Games4Doritos Feb 21, 2026
53771aa
Flake8
Games4Doritos Feb 21, 2026
e8954b4
Added back super().save() for some parts
Games4Doritos Feb 21, 2026
e3c7d7d
Made all save() functions asynchronous
Games4Doritos Feb 21, 2026
c808948
Merge branch 'main' into issue-64-Investigate_auto_filling_games_and_…
Games4Doritos Feb 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions server/game_dev/migrations/0015_event_games_event_jamid.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.1.15 on 2026-02-07 04:11

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('game_dev', "0014_merge_20260214_1420"),
]

operations = [
migrations.AddField(
model_name='event',
name='games',
field=models.JSONField(blank=True, default=list, help_text='Only filled if event is a Game Jam'),
),
migrations.AddField(
model_name='event',
name='jamID',
field=models.PositiveBigIntegerField(blank=True, null=True, unique=True, help_text="See documentation on how to find"),
),
]
62 changes: 62 additions & 0 deletions server/game_dev/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from django.db import models
from requests import get
from django.core.files.base import ContentFile


class Member(models.Model):
Expand All @@ -19,10 +21,70 @@ class Event(models.Model):
publicationDate = models.DateField()
cover_image = models.ImageField(upload_to="events/", null=True)
location = models.CharField(max_length=256)
jamID = models.PositiveBigIntegerField(unique=True, blank=True, null=True, help_text="See documentation on how to find")
games = models.JSONField(default=list, blank=True, help_text="Only filled if event is a Game Jam")

def __str__(self):
return self.name

def asave(self, force_insert=False, force_update=False, using="default", update_fields=None):
super().save(force_insert, force_update, using, update_fields)

def jamFail():
self.jamID = None
self.games = []

if self.jamID is not None:
try:
r = get(f"https://itch.io/jam/{self.jamID}/results.json")
except Exception as e:
print(e)
jamFail()
return super().asave(force_insert, force_update, using, update_fields)
try:
results = r.json()["results"]
except KeyError:
print("Error: No results for this Jam ID could be found")
jamFail()
return super().asave(force_insert, force_update, using, update_fields)
if len(results) == 0:
print("Error: No results for this Jam ID could be found")
jamFail()
return super().asave(force_insert, force_update, using, update_fields)
games = []
for i in results:
try:
cur = Game.objects.get(hostURL=i["url"], name=i["title"])
games.append(cur.pk)
except Game.DoesNotExist:
Game.objects.create(name=i["title"], completion=4, hostURL=i["url"], thumbnail="", event=self)

imageURL = i["cover_url"]
try:
# Uploads each image to the backend from their url
image = get(imageURL)
imageName = imageURL.split("/")[-1]
imageContent = ContentFile(image.content)
Game.objects.get(name=i["title"], hostURL=i["url"]).thumbnail.save(imageName, imageContent, save=True)
except Exception as e:
print(f"Error: {e}, most likely an invalid url for a game's cover image")

games.append(Game.objects.get(name=i["title"], hostURL=i["url"]).pk)
contributors = i["contributors"]
for x in contributors:
try:
socialMedia = SocialMedia.objects.get(socialMediaUserName=x["name"])
GameContributor.objects.create(game=Game.objects.get(name=i["title"], hostURL=i["url"],
member=socialMedia.member, role="Please add role manually"))
except Exception as e:
print(e)
continue

self.games = games
else:
self.games = []
return super().asave(force_insert, force_update, using, update_fields)


# GameContributor table: links Game, Member, and role (composite PK)
class GameContributor(models.Model):
Expand Down
Loading
Loading