Rename app

This commit is contained in:
Ludovic Stephan 2020-11-20 17:45:15 +01:00
parent e9fa92e6e5
commit 38251ba37e
9 changed files with 56 additions and 12 deletions

5
elections/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class ElectionsConfig(AppConfig):
name = "elections"

View file

@ -0,0 +1,49 @@
# Generated by Django 2.2.17 on 2020-11-20 15:31
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Election',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255, verbose_name='nom')),
('short_name', models.SlugField(unique=True, verbose_name='nom bref')),
('description', models.TextField(blank=True, verbose_name='description')),
('start_time', models.DateTimeField(verbose_name='date et heure de début')),
('end_time', models.DateTimeField(verbose_name='date et heure de fin')),
('results_public', models.BooleanField(default=False, verbose_name='résultats publics')),
('tallied', models.BooleanField(default=False, verbose_name='dépouillée')),
('archived', models.BooleanField(default=False, verbose_name='archivée')),
('created_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='Question',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('text', models.TextField(verbose_name='question')),
('election', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='questions', to='elections.Election')),
],
),
migrations.CreateModel(
name='Option',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('text', models.TextField(verbose_name='texte')),
('question', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='options', to='elections.Question')),
('voters', models.ManyToManyField(related_name='votes', to=settings.AUTH_USER_MODEL)),
],
),
]

View file

@ -19,6 +19,7 @@ class Election(models.Model):
results_public = models.BooleanField(_("résultats publics"), default=False)
tallied = models.BooleanField(_("dépouillée"), default=False)
# TODO : cache tally or recompute it each time ?
archived = models.BooleanField(_("archivée"), default=False)

View file

@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

View file

@ -1,5 +0,0 @@
from django.apps import AppConfig
class VotesConfig(AppConfig):
name = 'votes'

View file

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.