-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
106 additions
and
1 deletion.
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
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,61 @@ | ||
# Generated by Django 4.2.14 on 2024-10-10 13:20 | ||
|
||
import django.db.models.deletion | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
("peachjam", "0164_peachjamsettings_robots_txt"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="EditActivity", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("start", models.DateTimeField()), | ||
("end", models.DateTimeField()), | ||
("seconds", models.IntegerField()), | ||
( | ||
"stage", | ||
models.CharField( | ||
choices=[ | ||
("initial", "initial"), | ||
("corrections", "corrections"), | ||
], | ||
default="initial", | ||
max_length=255, | ||
), | ||
), | ||
( | ||
"document", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="peachjam.coredocument", | ||
), | ||
), | ||
( | ||
"user", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to=settings.AUTH_USER_MODEL, | ||
), | ||
), | ||
], | ||
options={ | ||
"ordering": ("start",), | ||
}, | ||
), | ||
] |
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 @@ | ||
from django.contrib.auth.models import User | ||
from django.db import models | ||
|
||
from peachjam.models import CoreDocument | ||
|
||
|
||
class EditActivity(models.Model): | ||
"""Time spent editing a document via the admin area.""" | ||
|
||
document = models.ForeignKey(CoreDocument, on_delete=models.CASCADE) | ||
user = models.ForeignKey(User, on_delete=models.CASCADE) | ||
start = models.DateTimeField() | ||
end = models.DateTimeField() | ||
seconds = models.IntegerField() | ||
stage = models.CharField( | ||
max_length=255, | ||
choices=(("initial", "initial"), ("corrections", "corrections")), | ||
default="initial", | ||
) | ||
|
||
class Meta: | ||
ordering = ("start",) | ||
|
||
def save(self, *args, **kwargs): | ||
self.seconds = (self.end - self.start).total_seconds() | ||
super().save(*args, **kwargs) |
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