Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
axellorreyne committed May 22, 2024
1 parent 37e961a commit 55f4666
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('projects', '0001_initial'),
]
Expand All @@ -14,6 +13,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='project',
name='test_dockerfile',
field=models.FileField(blank=True, null=True, upload_to=backend.pigeonhole.apps.projects.models.get_upload_to),
field=models.FileField(blank=True, null=True,
upload_to=backend.pigeonhole.apps.projects.models.get_upload_to),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('projects', '0002_project_test_dockerfile'),
]
Expand All @@ -14,11 +13,13 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='project',
name='test_dockerfile',
field=models.FileField(blank=True, null=True, upload_to=backend.pigeonhole.apps.projects.models.dockerfile_path),
field=models.FileField(blank=True, null=True,
upload_to=backend.pigeonhole.apps.projects.models.dockerfile_path),
),
migrations.AlterField(
model_name='project',
name='test_files',
field=models.FileField(blank=True, null=True, upload_to=backend.pigeonhole.apps.projects.models.testfile_path),
field=models.FileField(blank=True, null=True,
upload_to=backend.pigeonhole.apps.projects.models.testfile_path),
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
('projects', '0002_project_test_dockerfile'),
]
Expand All @@ -14,6 +13,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='project',
name='test_entrypoint',
field=models.FileField(blank=True, null=True, upload_to=backend.pigeonhole.apps.projects.models.get_upload_to),
field=models.FileField(blank=True, null=True,
upload_to=backend.pigeonhole.apps.projects.models.get_upload_to),
),
]
10 changes: 6 additions & 4 deletions backend/pigeonhole/apps/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from rest_framework import serializers

from backend.pigeonhole.apps.courses.models import Course
from django.conf import settings


def dockerfile_path(self, _):
Expand All @@ -11,16 +10,19 @@ def dockerfile_path(self, _):
self.id = self.pk = nextpk
return f'courses/id_{str(self.course_id.course_id)}/project/id_{str(self.project_id)}/DOCKERFILE'


def testfile_path(self, filename):
if not self.pk:
nextpk = Project.objects.order_by('-project_id').first().project_id + 1
self.id = self.pk = nextpk
return f'courses/id_{str(self.course_id.course_id)}/project/id_{str(self.project_id)}/{filename}'

#legacy code

# legacy code
def get_upload_to(self, filename):
return 'projects/' + str(self.project_id) + '/' + filename


class Project(models.Model):
objects = models.Manager()
project_id = models.BigAutoField(primary_key=True)
Expand All @@ -35,8 +37,8 @@ class Project(models.Model):
file_structure = models.TextField(blank=True, null=True)
conditions = models.TextField(blank=True, null=True)

#test_files = models.FileField(blank=True, null=True, upload_to=testfile_path)
#test_dockerfile = models.FileField(blank=True, null=True, upload_to=dockerfile_path)
# test_files = models.FileField(blank=True, null=True, upload_to=testfile_path)
# test_dockerfile = models.FileField(blank=True, null=True, upload_to=dockerfile_path)
test_docker_image = models.CharField(max_length=1024, blank=True, null=True)


Expand Down

0 comments on commit 55f4666

Please sign in to comment.