Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ __pycache__
*.otf
petitions/settings.py
mydatabase
*.bat
41 changes: 21 additions & 20 deletions index/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Generated by Django 2.1.1 on 2019-02-15 01:22
# Generated by Django 2.1.7 on 2019-04-01 00:53

import datetime
from django.db import migrations, models
import django.db.models.deletion
from django.utils.timezone import utc
import django.utils.timezone


class Migration(migrations.Migration):
Expand All @@ -16,26 +15,26 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="Petition",
fields=[
("title", models.CharField(max_length=200)),
("description", models.CharField(max_length=4000)),
(
"ID",
models.IntegerField(
primary_key=True, serialize=False, verbose_name=999999
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=200)),
("description", models.CharField(max_length=4000)),
("archived", models.BooleanField(default=False)),
("hidden", models.BooleanField(default=False)),
(
"created_date",
models.DateTimeField(
db_index=True,
default=datetime.datetime(
2019, 2, 15, 1, 22, 11, 359671, tzinfo=utc
),
db_index=True, default=django.utils.timezone.now
),
),
("expected_sig", models.IntegerField(verbose_name=300)),
("expected_sig", models.IntegerField(default=300)),
],
),
migrations.CreateModel(
Expand Down Expand Up @@ -76,11 +75,7 @@ class Migration(migrations.Migration):
),
(
"signed_date",
models.DateTimeField(
default=datetime.datetime(
2019, 2, 15, 1, 22, 11, 358683, tzinfo=utc
)
),
models.DateTimeField(default=django.utils.timezone.now),
),
],
),
Expand Down Expand Up @@ -120,6 +115,8 @@ class Migration(migrations.Migration):
model_name="petition",
name="author",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="petitions",
to="index.User",
Expand All @@ -129,6 +126,8 @@ class Migration(migrations.Migration):
model_name="petition",
name="senate_response",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name="petitions",
to="index.Response",
Expand All @@ -138,12 +137,14 @@ class Migration(migrations.Migration):
model_name="petition",
name="signatures",
field=models.ManyToManyField(
related_name="petitions", to="index.Signature"
blank=True, related_name="petitions", to="index.Signature"
),
),
migrations.AddField(
model_name="petition",
name="tags",
field=models.ManyToManyField(related_name="petitions", to="index.Tag"),
field=models.ManyToManyField(
blank=True, related_name="petitions", to="index.Tag"
),
),
]
28 changes: 0 additions & 28 deletions index/migrations/0002_auto_20190215_0130.py

This file was deleted.

68 changes: 0 additions & 68 deletions index/migrations/0003_auto_20190215_0136.py

This file was deleted.

58 changes: 0 additions & 58 deletions index/migrations/0004_auto_20190215_0140.py

This file was deleted.

31 changes: 0 additions & 31 deletions index/migrations/0005_auto_20190303_0230.py

This file was deleted.

4 changes: 2 additions & 2 deletions index/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models
from django.utils import timezone
from django.conf import settings

# Creates a tag, there can be at most three in a single petition
class Tag(models.Model):
Expand Down Expand Up @@ -122,15 +123,14 @@ def add_info_other(self, info):
class Petition(models.Model):
title = models.CharField(max_length=200) # Title of petition
description = models.CharField(max_length=4000) # The paragraph description
ID = models.IntegerField(primary_key=True)
archived = models.BooleanField(default=False)
hidden = models.BooleanField(default=False)

created_date = models.DateTimeField(
db_index=True, default=timezone.now
) # Files the date created
expected_sig = models.IntegerField(
300
default=settings.DEFAULT_EXPECTED_SIGS
) # The expected signature to move to the next step

author = models.ForeignKey(
Expand Down
7 changes: 7 additions & 0 deletions petitions/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@

SECRET_KEY = os.environ.get("SECRET_KEY")

# Represents the default value of the expected signatures field for a petition.
# Defaults to 300.
DEFAULT_EXPECTED_SIGS = os.environ.get("DEFAULT_EXPECTED_SIGS")

if DEFAULT_EXPECTED_SIGS == None:
DEFAULT_EXPECTED_SIGS = 300

ALLOWED_HOSTS = []


Expand Down