Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Helios Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Helios Server
Commits
f768800b
Unverified
Commit
f768800b
authored
6 years ago
by
Marco Ciotola
Browse files
Options
Downloads
Patches
Plain Diff
[DJ2] on_delete will be a required arg for ForeignKey, currently defaults to models.CASCADE.
parent
6e4c92c0
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
helios/migrations/0001_initial.py
+8
-8
8 additions, 8 deletions
helios/migrations/0001_initial.py
helios/models.py
+8
-8
8 additions, 8 deletions
helios/models.py
with
16 additions
and
16 deletions
helios/migrations/0001_initial.py
+
8
−
8
View file @
f768800b
...
...
@@ -87,7 +87,7 @@ class Migration(migrations.Migration):
(
'
result_proof
'
,
helios_auth
.
jsonfield
.
JSONField
(
null
=
True
)),
(
'
help_email
'
,
models
.
EmailField
(
max_length
=
75
,
null
=
True
)),
(
'
election_info_url
'
,
models
.
CharField
(
max_length
=
300
,
null
=
True
)),
(
'
admin
'
,
models
.
ForeignKey
(
to
=
'
helios_auth.User
'
)),
(
'
admin
'
,
models
.
ForeignKey
(
to
=
'
helios_auth.User
'
,
on_delete
=
models
.
CASCADE
)),
],
options
=
{
'
abstract
'
:
False
,
...
...
@@ -100,7 +100,7 @@ class Migration(migrations.Migration):
(
'
id
'
,
models
.
AutoField
(
verbose_name
=
'
ID
'
,
serialize
=
False
,
auto_created
=
True
,
primary_key
=
True
)),
(
'
log
'
,
models
.
CharField
(
max_length
=
500
)),
(
'
at
'
,
models
.
DateTimeField
(
auto_now_add
=
True
)),
(
'
election
'
,
models
.
ForeignKey
(
to
=
'
helios.Election
'
)),
(
'
election
'
,
models
.
ForeignKey
(
to
=
'
helios.Election
'
,
on_delete
=
models
.
CASCADE
)),
],
options
=
{
},
...
...
@@ -120,7 +120,7 @@ class Migration(migrations.Migration):
(
'
pok
'
,
helios
.
datatypes
.
djangofield
.
LDObjectField
(
null
=
True
)),
(
'
decryption_factors
'
,
helios
.
datatypes
.
djangofield
.
LDObjectField
(
null
=
True
)),
(
'
decryption_proofs
'
,
helios
.
datatypes
.
djangofield
.
LDObjectField
(
null
=
True
)),
(
'
election
'
,
models
.
ForeignKey
(
to
=
'
helios.Election
'
)),
(
'
election
'
,
models
.
ForeignKey
(
to
=
'
helios.Election
'
,
on_delete
=
models
.
CASCADE
)),
],
options
=
{
},
...
...
@@ -139,8 +139,8 @@ class Migration(migrations.Migration):
(
'
vote
'
,
helios
.
datatypes
.
djangofield
.
LDObjectField
(
null
=
True
)),
(
'
vote_hash
'
,
models
.
CharField
(
max_length
=
100
,
null
=
True
)),
(
'
cast_at
'
,
models
.
DateTimeField
(
null
=
True
)),
(
'
election
'
,
models
.
ForeignKey
(
to
=
'
helios.Election
'
)),
(
'
user
'
,
models
.
ForeignKey
(
to
=
'
helios_auth.User
'
,
null
=
True
)),
(
'
election
'
,
models
.
ForeignKey
(
to
=
'
helios.Election
'
,
on_delete
=
models
.
CASCADE
)),
(
'
user
'
,
models
.
ForeignKey
(
to
=
'
helios_auth.User
'
,
null
=
True
,
on_delete
=
models
.
CASCADE
)),
],
options
=
{
},
...
...
@@ -156,7 +156,7 @@ class Migration(migrations.Migration):
(
'
processing_started_at
'
,
models
.
DateTimeField
(
null
=
True
)),
(
'
processing_finished_at
'
,
models
.
DateTimeField
(
null
=
True
)),
(
'
num_voters
'
,
models
.
IntegerField
(
null
=
True
)),
(
'
election
'
,
models
.
ForeignKey
(
to
=
'
helios.Election
'
)),
(
'
election
'
,
models
.
ForeignKey
(
to
=
'
helios.Election
'
,
on_delete
=
models
.
CASCADE
)),
],
options
=
{
},
...
...
@@ -173,13 +173,13 @@ class Migration(migrations.Migration):
migrations
.
AddField
(
model_name
=
'
castvote
'
,
name
=
'
voter
'
,
field
=
models
.
ForeignKey
(
to
=
'
helios.Voter
'
),
field
=
models
.
ForeignKey
(
to
=
'
helios.Voter
'
,
on_delete
=
models
.
CASCADE
),
preserve_default
=
True
,
),
migrations
.
AddField
(
model_name
=
'
auditedballot
'
,
name
=
'
election
'
,
field
=
models
.
ForeignKey
(
to
=
'
helios.Election
'
),
field
=
models
.
ForeignKey
(
to
=
'
helios.Election
'
,
on_delete
=
models
.
CASCADE
),
preserve_default
=
True
,
),
]
This diff is collapsed.
Click to expand it.
helios/models.py
+
8
−
8
View file @
f768800b
...
...
@@ -32,7 +32,7 @@ class HeliosModel(models.Model, datatypes.LDObjectContainer):
abstract
=
True
class
Election
(
HeliosModel
):
admin
=
models
.
ForeignKey
(
User
)
admin
=
models
.
ForeignKey
(
User
,
on_delete
=
models
.
CASCADE
)
uuid
=
models
.
CharField
(
max_length
=
50
,
null
=
False
)
...
...
@@ -662,7 +662,7 @@ class ElectionLog(models.Model):
VOTER_FILE_ADDED
=
"
voter file added
"
DECRYPTIONS_COMBINED
=
"
decryptions combined
"
election
=
models
.
ForeignKey
(
Election
)
election
=
models
.
ForeignKey
(
Election
,
on_delete
=
models
.
CASCADE
)
log
=
models
.
CharField
(
max_length
=
500
)
at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
...
...
@@ -697,7 +697,7 @@ class VoterFile(models.Model):
# path where we store voter upload
PATH
=
settings
.
VOTER_UPLOAD_REL_PATH
election
=
models
.
ForeignKey
(
Election
)
election
=
models
.
ForeignKey
(
Election
,
on_delete
=
models
.
CASCADE
)
# we move to storing the content in the DB
voter_file
=
models
.
FileField
(
upload_to
=
PATH
,
max_length
=
250
,
null
=
True
)
...
...
@@ -790,7 +790,7 @@ class VoterFile(models.Model):
class
Voter
(
HeliosModel
):
election
=
models
.
ForeignKey
(
Election
)
election
=
models
.
ForeignKey
(
Election
,
on_delete
=
models
.
CASCADE
)
# let's link directly to the user now
# FIXME: delete this as soon as migrations are set up
...
...
@@ -802,7 +802,7 @@ class Voter(HeliosModel):
# for users of type password, no user object is created
# but a dynamic user object is created automatically
user
=
models
.
ForeignKey
(
'
helios_auth.User
'
,
null
=
True
)
user
=
models
.
ForeignKey
(
'
helios_auth.User
'
,
null
=
True
,
on_delete
=
models
.
CASCADE
)
# if user is null, then you need a voter login ID and password
voter_login_id
=
models
.
CharField
(
max_length
=
100
,
null
=
True
)
...
...
@@ -988,7 +988,7 @@ class Voter(HeliosModel):
class
CastVote
(
HeliosModel
):
# the reference to the voter provides the voter_uuid
voter
=
models
.
ForeignKey
(
Voter
)
voter
=
models
.
ForeignKey
(
Voter
,
on_delete
=
models
.
CASCADE
)
# the actual encrypted vote
vote
=
LDObjectField
(
type_hint
=
'
legacy/EncryptedVote
'
)
...
...
@@ -1098,7 +1098,7 @@ class AuditedBallot(models.Model):
"""
ballots for auditing
"""
election
=
models
.
ForeignKey
(
Election
)
election
=
models
.
ForeignKey
(
Election
,
on_delete
=
models
.
CASCADE
)
raw_vote
=
models
.
TextField
()
vote_hash
=
models
.
CharField
(
max_length
=
100
)
added_at
=
models
.
DateTimeField
(
auto_now_add
=
True
)
...
...
@@ -1125,7 +1125,7 @@ class AuditedBallot(models.Model):
class
Trustee
(
HeliosModel
):
election
=
models
.
ForeignKey
(
Election
)
election
=
models
.
ForeignKey
(
Election
,
on_delete
=
models
.
CASCADE
)
uuid
=
models
.
CharField
(
max_length
=
50
)
name
=
models
.
CharField
(
max_length
=
200
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment