Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
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
ots
hypha
Commits
dc0dedbe
Commit
dc0dedbe
authored
6 years ago
by
Dan Braghis
Browse files
Options
Downloads
Patches
Plain Diff
Add created/updated timestamps
parent
a3802481
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/determinations/migrations/0002_add_timestamps.py
+26
-0
26 additions, 0 deletions
...ch/apply/determinations/migrations/0002_add_timestamps.py
opentech/apply/determinations/models.py
+9
-6
9 additions, 6 deletions
opentech/apply/determinations/models.py
with
35 additions
and
6 deletions
opentech/apply/determinations/migrations/0002_add_timestamps.py
0 → 100644
+
26
−
0
View file @
dc0dedbe
# Generated by Django 2.0.2 on 2018-06-14 09:46
from
django.db
import
migrations
,
models
import
django.utils.timezone
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
determinations
'
,
'
0001_initial
'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'
determination
'
,
name
=
'
created_at
'
,
field
=
models
.
DateTimeField
(
auto_now_add
=
True
,
verbose_name
=
'
Creation time
'
),
preserve_default
=
False
,
),
migrations
.
AddField
(
model_name
=
'
determination
'
,
name
=
'
updated_at
'
,
field
=
models
.
DateTimeField
(
auto_now
=
True
,
verbose_name
=
'
Update time
'
),
preserve_default
=
False
,
),
]
This diff is collapsed.
Click to expand it.
opentech/apply/determinations/models.py
+
9
−
6
View file @
dc0dedbe
...
...
@@ -4,6 +4,7 @@ from django.db import models
from
django.db.models.signals
import
post_save
from
django.dispatch
import
receiver
from
django.urls
import
reverse
from
django.utils.translation
import
ugettext_lazy
as
_
from
opentech.apply.activity.models
import
Activity
...
...
@@ -12,9 +13,9 @@ UNDETERMINED = 1
APPROVED
=
2
DETERMINATION_CHOICES
=
(
(
UNAPPROVED
,
'
Unapproved
'
),
(
UNDETERMINED
,
'
Undetermined
'
),
(
APPROVED
,
'
Approved
'
),
(
UNAPPROVED
,
_
(
'
Unapproved
'
)
)
,
(
UNDETERMINED
,
_
(
'
Undetermined
'
)
)
,
(
APPROVED
,
_
(
'
Approved
'
)
)
,
)
...
...
@@ -29,8 +30,10 @@ class Determination(models.Model):
on_delete
=
models
.
PROTECT
,
)
determination_data
=
JSONField
()
determination
=
models
.
IntegerField
(
verbose_name
=
"
Determination
"
,
choices
=
DETERMINATION_CHOICES
,
default
=
0
)
is_draft
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
"
Draft
"
)
determination
=
models
.
IntegerField
(
verbose_name
=
_
(
"
Determination
"
),
choices
=
DETERMINATION_CHOICES
,
default
=
0
)
is_draft
=
models
.
BooleanField
(
default
=
False
,
verbose_name
=
_
(
"
Draft
"
))
created_at
=
models
.
DateTimeField
(
verbose_name
=
_
(
'
Creation time
'
),
auto_now_add
=
True
)
updated_at
=
models
.
DateTimeField
(
verbose_name
=
_
(
'
Update time
'
),
auto_now
=
True
)
class
Meta
:
unique_together
=
(
'
author
'
,
'
submission
'
)
...
...
@@ -42,7 +45,7 @@ class Determination(models.Model):
return
f
'
Determination for
{
self
.
submission
.
title
}
by
{
self
.
author
!s}
'
def
__repr__
(
self
):
return
f
'
<
{
self
.
__class__
.
__name__
}
:
{
str
(
self
.
determination_
responses
)
}
>
'
return
f
'
<
{
self
.
__class__
.
__name__
}
:
{
str
(
self
.
determination_
data
)
}
>
'
@receiver
(
post_save
,
sender
=
Determination
)
...
...
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