Skip to content

Commit

Permalink
fix(imports): fixed imports
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Oct 23, 2023
1 parent ca58210 commit b572177
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
run: poetry install

- name: Run black
run: poetry run black --check .
run: poetry run black *.py --check .

- name: Run flake8
run: poetry run flake8
4 changes: 2 additions & 2 deletions backend/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'outdated.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "outdated.settings")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand All @@ -18,5 +18,5 @@ def main():
execute_from_command_line(sys.argv)


if __name__ == '__main__':
if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion backend/outdated/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'outdated.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "outdated.settings")

application = get_asgi_application()
74 changes: 53 additions & 21 deletions backend/outdated/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,83 @@
# Generated by Django 3.2.16 on 2023-01-25 13:43

from django.db import migrations, models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

initial = True

dependencies = [
]
dependencies = []

operations = [
migrations.CreateModel(
name='Dependency',
name="Dependency",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True)),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=100, unique=True)),
],
options={
'ordering': ['name'],
"ordering": ["name"],
},
),
migrations.CreateModel(
name='DependencyVersion',
name="DependencyVersion",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('version', models.CharField(max_length=100)),
('release_date', models.DateField()),
('end_of_life_date', models.DateField()),
('dependency', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='outdated.dependency')),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("version", models.CharField(max_length=100)),
("release_date", models.DateField()),
("end_of_life_date", models.DateField()),
(
"dependency",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="outdated.dependency",
),
),
],
options={
'ordering': ['end_of_life_date'],
'unique_together': {('dependency', 'version')},
"ordering": ["end_of_life_date"],
"unique_together": {("dependency", "version")},
},
),
migrations.CreateModel(
name='Project',
name="Project",
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100, unique=True)),
('repo', models.URLField(unique=True)),
('dependency_versions', models.ManyToManyField(blank=True, to='outdated.DependencyVersion')),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=100, unique=True)),
("repo", models.URLField(unique=True)),
(
"dependency_versions",
models.ManyToManyField(blank=True, to="outdated.DependencyVersion"),
),
],
options={
'ordering': ['status'],
"ordering": ["status"],
},
),
]
6 changes: 3 additions & 3 deletions backend/outdated/migrations/0002_alter_project_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
class Migration(migrations.Migration):

dependencies = [
('outdated', '0001_initial'),
("outdated", "0001_initial"),
]

operations = [
migrations.AlterModelOptions(
name='project',
options={'ordering': ['name']},
name="project",
options={"ordering": ["name"]},
),
]
2 changes: 1 addition & 1 deletion backend/outdated/outdated/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.contrib import admin
# from django.contrib import admin

# Register your models here.
1 change: 1 addition & 0 deletions backend/outdated/outdated/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import date, timedelta

from django.db import models

# Create your models here.
Expand Down
9 changes: 5 additions & 4 deletions backend/outdated/outdated/serializers.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
from outdated.outdated.models import Dependency, DependencyVersion, Project
from rest_framework_json_api import serializers

from outdated.outdated.models import Dependency, DependencyVersion, Project


class DependencySerializer(serializers.HyperlinkedModelSerializer):
class DependencySerializer(serializers.ModelSerializer):
class Meta:
model = Dependency
fields = "__all__"


class DependencyVersionSerializer(serializers.HyperlinkedModelSerializer):
class DependencyVersionSerializer(serializers.ModelSerializer):
status = serializers.ReadOnlyField()

class Meta:
model = DependencyVersion
fields = "__all__"


class ProjectSerializer(serializers.HyperlinkedModelSerializer):
class ProjectSerializer(serializers.ModelSerializer):
status = serializers.ReadOnlyField()

class Meta:
Expand Down
2 changes: 1 addition & 1 deletion backend/outdated/outdated/tests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.test import TestCase
# from django.test import TestCase

# Create your tests here.
14 changes: 8 additions & 6 deletions backend/outdated/outdated/views.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
from outdated.outdated.models import Dependency, DependencyVersion, Project
from outdated.outdated.serializers import (
DependencySerializer,
DependencyVersionSerializer,
ProjectSerializer,
)
from rest_framework import viewsets

# fmt: off
from outdated.outdated.models import Dependency, DependencyVersion, Project
from outdated.outdated.serializers import (DependencySerializer,
DependencyVersionSerializer,
ProjectSerializer)

# fmt: on


class ProjectViewSet(viewsets.ModelViewSet):
queryset = Project.objects.all()
Expand Down
2 changes: 1 addition & 1 deletion backend/outdated/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@
"rest_framework.parsers.MultiPartParser",
),
"DEFAULT_RENDERER_CLASSES": (
"rest_framework_json_api.renderers.JSONRenderer",
# If you're performance testing, you will want to use the browseable API
# without forms, as the forms can generate their own queries.
# If performance testing, enable:
"rest_framework_json_api.renderers.JSONRenderer",
# Otherwise, to play around with the browseable API, enable:
# "rest_framework.renderers.BrowsableAPIRenderer",
),
Expand Down
3 changes: 2 additions & 1 deletion backend/outdated/urls.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from django.contrib import admin
from django.urls import include, path
from outdated.outdated import views
from rest_framework import routers

from outdated.outdated import views

router = routers.DefaultRouter()
router.register(r"projects", views.ProjectViewSet)
router.register(r"dependencies", views.DependencyViewSet)
Expand Down
2 changes: 1 addition & 1 deletion backend/outdated/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@

from django.core.wsgi import get_wsgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'outdated.settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "outdated.settings")

application = get_wsgi_application()

0 comments on commit b572177

Please sign in to comment.