-
Notifications
You must be signed in to change notification settings - Fork 0
[Interactive Fiction] Database storing twine files in byte type #1291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
…sible from a link
gkharrell01
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gkharrell01
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Exciting that a game can be stored! Exciting to see more tangible work.
| operations = [ | ||
| migrations.AddField( | ||
| model_name="game", | ||
| name="twine_file_content", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smart to use original game model!
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of migrations, I wonder if there is an ability in a further PR to make these cumulative.
| # ✅ Manually assign uploaded file | ||
| if self.request.FILES.get("twine_file"): | ||
| self.object.twine_file = self.request.FILES["twine_file"] | ||
| # save both the file and its contents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, readable comments
| <br /> | ||
| {% endfor %} | ||
| <!-- Twine upload (manual field) --> | ||
| <label for="id_twine_file">Upload Twine Game (.html):</label> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking this will be updated once we merge other templates in other branches into dev
|
Test seems to be failed now from some tournament and lobby objects after merging with dev... not sure what to do as that's unrelated to us. |
|
following up on this -- it would also be helpful if this game had a different name to match its purpose |
Changed! It is should now be named "Twine Test Game" |
|
i've run into like a million merge conflicts and errors particularly from this repeating error: i'm not even sure how this is related and it does not even exist on my thing so i'm going to just try again to make a placeholder for it... |
|
Ran into even more merge conflicts and have no idea how to resolve this since its not really related to my code? maybe something from working with the database but I have no idea |


An issue we've run into is that uploaded IF games are stored locally and only visible to different people. A possible workaround in order to implement a way for created IF games to be stored in the database is to do so that when someone runs migrations they can see the game on their site no matter who they are.
This is related to issue #1197
Since the website is not deployed, this is kind of not really feasible in a normal way but perhaps this can be done by editing the game model.
The main step is to store the twine file in binary and is accessible at a link resembling http://127.0.0.1:8000/games/twine-db/23/ (this is an example, like it would have the "twine-db" part)
After uploading "test-db" game I checked:
And confirmed it was saved in binary.
The next step is to see if others can access the game but otherwise it has successfully been store in bytes which was the goal and achieved by altering the game model to store the file as a binary field rather than file field and updating all other files referencing it accordingly.
In order to see if others can access the same game, I will put the game in a fixture file
Which you can get by running python manage.py migrate
After pulling the branch.
You should see a game called "Midterm Project"