-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'frontend' of https://github.com/SELab-2/UGent-4 into fr…
…ontend
- Loading branch information
Showing
110 changed files
with
12,215 additions
and
4,619 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from django.db import models | ||
from django.contrib.auth.models import User | ||
|
||
|
||
def upload_to(instance, filename): | ||
""" | ||
Functie om het pad te genereren waar het bestand wordt opgeslagen. | ||
Args: | ||
instance: De huidige instantie van het model. | ||
filename (str): De oorspronkelijke bestandsnaam. | ||
Returns: | ||
str: Het pad waar het bestand moet worden opgeslagen. | ||
""" | ||
return f"data/templates/gebruiker_{instance.user.id}/{filename}" | ||
|
||
|
||
class Template(models.Model): | ||
|
||
template_id = models.AutoField(primary_key=True) | ||
user = models.ForeignKey( | ||
User, related_name="template_user", on_delete=models.CASCADE | ||
) | ||
bestand = models.FileField(upload_to=upload_to) | ||
|
||
def __str__(self): | ||
return str(self.bestand.name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from rest_framework import serializers | ||
from api.models.template import Template | ||
|
||
|
||
class TemplateSerializer(serializers.ModelSerializer): | ||
""" | ||
Serializer voor het serialiseren en deserialiseren van IndieningBestand objecten. | ||
Fields: | ||
Meta.model (IndieningBestand): Het model waarop de serializer is gebaseerd. | ||
Meta.fields (tuple): De velden die moeten worden opgenomen in de serializer. Hier worden alle velden opgenomen. | ||
""" | ||
|
||
class Meta: | ||
model = Template | ||
fields = "__all__" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.