Loading README.md +1 −3 Changes for README.md: 1 added line, 3 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ ## Run for development - clone the repo - make sure you have [uv](https://docs.astral.sh/uv/) installed - run `uv pre-commit install` to install the pre-commit git hook - create venv and install dependencies: `uv sync --frozen` - setup environmental variables: `cp sample.env .env` and adjust values as needed - run migrations: `uv run manage.py migrate` Loading @@ -19,6 +20,3 @@ - build the image (e.g. `buildah build -t wybory:latest .`) - review and edit `compose.yaml` to your needs, you can mount a custom gunicorn config - run the stack (e.g. `podman compose up -d`) <small>Adam syyyyf</small> No newline at end of file api/admin.py +0 −2 Changes for api/admin.py: 0 added lines, 2 removed lines. Original line number Diff line number Diff line from django.contrib import admin # Register your models here. api/apps.py +1 −1 Changes for api/apps.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,4 +2,4 @@ from django.apps import AppConfig class ApiConfig(AppConfig): name = 'api' name = "api" api/models.py +0 −2 Changes for api/models.py: 0 added lines, 2 removed lines. Original line number Diff line number Diff line from django.db import models # Create your models here. api/serializers.py +18 −4 Changes for api/serializers.py: 18 added lines, 4 removed lines. Original line number Diff line number Diff line from rest_framework import serializers from elections.models import Election, Option from voters.models import Voter class ElectionListSerializer(serializers.ModelSerializer): class Meta: model = Election fields = ['id', 'alias', 'name', 'description', 'start_date', 'end_date', 'has_voted'] fields = [ "id", "alias", "name", "description", "start_date", "end_date", "has_voted", ] class OptionSerializer(serializers.ModelSerializer): class Meta: model = Option fields = ['id', 'name'] fields = ["id", "name"] class ElectionSerializer(serializers.ModelSerializer): options = OptionSerializer(many=True, read_only=True) class Meta: model = Election fields = ['id', 'alias', 'name', 'description', 'allow_invalid', 'options'] fields = ["id", "alias", "name", "description", "allow_invalid", "options"] class VoterSerializer(serializers.ModelSerializer): group_name = serializers.ReadOnlyField(source="group.display_name") class Meta: model = Voter fields = ['name', 'group_name'] No newline at end of file fields = ["name", "group_name"] Loading
README.md +1 −3 Changes for README.md: 1 added line, 3 removed lines. Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ ## Run for development - clone the repo - make sure you have [uv](https://docs.astral.sh/uv/) installed - run `uv pre-commit install` to install the pre-commit git hook - create venv and install dependencies: `uv sync --frozen` - setup environmental variables: `cp sample.env .env` and adjust values as needed - run migrations: `uv run manage.py migrate` Loading @@ -19,6 +20,3 @@ - build the image (e.g. `buildah build -t wybory:latest .`) - review and edit `compose.yaml` to your needs, you can mount a custom gunicorn config - run the stack (e.g. `podman compose up -d`) <small>Adam syyyyf</small> No newline at end of file
api/admin.py +0 −2 Changes for api/admin.py: 0 added lines, 2 removed lines. Original line number Diff line number Diff line from django.contrib import admin # Register your models here.
api/apps.py +1 −1 Changes for api/apps.py: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,4 +2,4 @@ from django.apps import AppConfig class ApiConfig(AppConfig): name = 'api' name = "api"
api/models.py +0 −2 Changes for api/models.py: 0 added lines, 2 removed lines. Original line number Diff line number Diff line from django.db import models # Create your models here.
api/serializers.py +18 −4 Changes for api/serializers.py: 18 added lines, 4 removed lines. Original line number Diff line number Diff line from rest_framework import serializers from elections.models import Election, Option from voters.models import Voter class ElectionListSerializer(serializers.ModelSerializer): class Meta: model = Election fields = ['id', 'alias', 'name', 'description', 'start_date', 'end_date', 'has_voted'] fields = [ "id", "alias", "name", "description", "start_date", "end_date", "has_voted", ] class OptionSerializer(serializers.ModelSerializer): class Meta: model = Option fields = ['id', 'name'] fields = ["id", "name"] class ElectionSerializer(serializers.ModelSerializer): options = OptionSerializer(many=True, read_only=True) class Meta: model = Election fields = ['id', 'alias', 'name', 'description', 'allow_invalid', 'options'] fields = ["id", "alias", "name", "description", "allow_invalid", "options"] class VoterSerializer(serializers.ModelSerializer): group_name = serializers.ReadOnlyField(source="group.display_name") class Meta: model = Voter fields = ['name', 'group_name'] No newline at end of file fields = ["name", "group_name"]