forked from EGCETSII/decide_django_2
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from bencrealc/master
Merge grupo 2 decide penyagolosa
- Loading branch information
Showing
30 changed files
with
458 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Title: Summary, imperative, start upper case, don't end with a period | ||
# No more than 50 chars. #### 50 chars is here: # | ||
|
||
# Remember blank line between title and body. | ||
|
||
# Body: Explain *what* and *why* (not *how*). | ||
# Wrap at 72 chars. ################################## which is here: # | ||
|
||
|
||
# At the end: Include Co-authored-by for all contributors. | ||
# Include at least one empty line before it. Format: | ||
# Co-authored-by: name <user@users.noreply.github.com> | ||
# | ||
# How to Write a Git Commit Message: | ||
# https://chris.beams.io/posts/git-commit/ | ||
# | ||
# 1.Separate subject from body with a blank line | ||
# 2. Limit the subject line to 50 characters | ||
# 3. Capitalize the subject line | ||
# 4. Do not end the subject line with a period | ||
# 5. Use the imperative mood in the subject line | ||
# 6. Wrap the body at 72 characters | ||
# 7. Use the body to explain what and why vs. how |
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,42 @@ | ||
name: Python application | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
services: | ||
postgres: | ||
image: postgres:10.8 | ||
env: | ||
POSTGRES_USER: decide | ||
POSTGRES_PASSWORD: decide | ||
POSTGRES_DB: decide | ||
ports: | ||
- 5432:5432 | ||
# needed because the postgres container does not provide a healthcheck | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Set up Python 3.8 | ||
uses: actions/setup-python@v1 | ||
with: | ||
python-version: 3.8 | ||
- name: psycopg2 prerequisites | ||
run: sudo apt-get install libpq-dev | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
pip install codacy-coverage | ||
- name: Run migrations | ||
run: cd decide;python manage.py migrate | ||
- name: Run tests | ||
run: cd decide;coverage run --branch --source=. ./manage.py test voting --keepdb; coverage xml; | ||
- name: Codacy Coverage Reporter | ||
uses: codacy/codacy-coverage-reporter-action@v1.1.0 | ||
with: | ||
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} | ||
coverage-reports: decide/coverage.xml |
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 |
---|---|---|
|
@@ -210,4 +210,4 @@ <h2>[[ voting.question.desc ]]</h2> | |
}) | ||
</script> | ||
</body> | ||
{% endblock %} | ||
{% endblock %} |
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,27 @@ | ||
{% extends "base.html" %} | ||
{% load i18n static %} | ||
|
||
{% block content %} | ||
<link rel="stylesheet" href="/static/css/style.css"> | ||
<table> | ||
<tr> | ||
<th>Name</th> | ||
<th>Start Date</th> | ||
<th>Vote</th> | ||
</tr> | ||
|
||
{% for v in votings %} | ||
<tr> | ||
<td>{{v.name}}</td> | ||
{% if v.start_date is None %} | ||
<td>It's not started</td> | ||
{% else %} | ||
<td>{{v.start_date}}</td> | ||
{% endif %} | ||
<td><a href='/booth/{{v.id}}/'>Vote</a></td> | ||
</tr> | ||
{% endfor %} | ||
|
||
</table> | ||
|
||
{% endblock %} |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from django.urls import path | ||
from .views import BoothView | ||
|
||
from . import views | ||
|
||
urlpatterns = [ | ||
path('<int:voting_id>/', BoothView.as_view()), | ||
path('voting', views.votings), | ||
] |
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,26 @@ | ||
# Generated by Django 2.0 on 2021-12-19 17:30 | ||
|
||
from django.db import migrations, models | ||
import voting.validators | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('voting', '0003_auto_20180605_0842'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Detector', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('word', models.TextField()), | ||
], | ||
), | ||
migrations.AlterField( | ||
model_name='voting', | ||
name='desc', | ||
field=models.TextField(blank=True, null=True, validators=[voting.validators.lofensivo]), | ||
), | ||
] |
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,36 @@ | ||
# Generated by Django 2.0 on 2021-12-20 16:57 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('voting', '0003_auto_20180605_0842'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='RespuestaBinaria', | ||
fields=[ | ||
('id', models.AutoField(primary_key=True, serialize=False)), | ||
('respuesta', models.BooleanField(choices=[(1, 'Sí'), (0, 'No')])), | ||
], | ||
), | ||
migrations.CreateModel( | ||
name='VotacionBinaria', | ||
fields=[ | ||
('id', models.AutoField(primary_key=True, serialize=False)), | ||
('titulo', models.CharField(max_length=60)), | ||
('descripcion', models.TextField()), | ||
('fecha_inicio', models.DateTimeField(blank=True, null=True)), | ||
('fecha_fin', models.DateTimeField(blank=True, null=True)), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name='respuestabinaria', | ||
name='votacionBinaria', | ||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='respuestasBinarias', to='voting.VotacionBinaria'), | ||
), | ||
] |
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 @@ | ||
# Generated by Django 2.0 on 2021-12-20 20:01 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('voting', '0004_auto_20211220_1657'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='respuestabinaria', | ||
name='votacionBinaria', | ||
), | ||
migrations.AddField( | ||
model_name='question', | ||
name='yes_no_question', | ||
field=models.BooleanField(default=False, help_text='Check the box to generate automatically the options yes/no ', verbose_name='Yes/No question'), | ||
), | ||
migrations.DeleteModel( | ||
name='RespuestaBinaria', | ||
), | ||
migrations.DeleteModel( | ||
name='VotacionBinaria', | ||
), | ||
] |
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,21 @@ | ||
# Generated by Django 2.0 on 2021-12-19 18:02 | ||
|
||
import django.core.validators | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('voting', '0004_auto_20211219_1730'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Percentage', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('number', models.PositiveIntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100)])), | ||
], | ||
), | ||
] |
24 changes: 24 additions & 0 deletions
24
decide/voting/migrations/0006_alter_voting_postproc_alter_voting_tally.py
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,24 @@ | ||
# Generated by Django 4.0 on 2022-01-01 18:59 | ||
|
||
from django.db import migrations | ||
from django.contrib.postgres.fields import JSONField | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('voting', '0005_percentage'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='voting', | ||
name='postproc', | ||
field=JSONField(blank=True, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='voting', | ||
name='tally', | ||
field=JSONField(blank=True, null=True), | ||
), | ||
] |
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,22 @@ | ||
# Generated by Django 2.0 on 2021-12-20 22:25 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('voting', '0005_auto_20211220_2001'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='question', | ||
name='yes_no_question', | ||
), | ||
migrations.AddField( | ||
model_name='question', | ||
name='binary_question', | ||
field=models.BooleanField(default=False, help_text='Check the box to generate a binary question', verbose_name='Answers Yes/No'), | ||
), | ||
] |
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,14 @@ | ||
# Generated by Django 2.0 on 2022-01-03 18:20 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('voting', '0006_auto_20211220_2225'), | ||
('voting', '0006_alter_voting_postproc_alter_voting_tally'), | ||
] | ||
|
||
operations = [ | ||
] |
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,14 @@ | ||
# Generated by Django 2.0 on 2022-01-04 16:53 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('voting', '0006_auto_20211220_2225'), | ||
('voting', '0006_alter_voting_postproc_alter_voting_tally'), | ||
] | ||
|
||
operations = [ | ||
] |
Oops, something went wrong.