-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
On-hold flag and celery task for applicationstatus updates. #253
base: main
Are you sure you want to change the base?
Changes from 1 commit
7574859
20bcc16
f9e5511
6a4c092
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
RegistryPublishedPerson, | ||
Registrant, | ||
Registrar, | ||
TimeFlag, | ||
) | ||
from .filters import ( | ||
StatusFilter, | ||
|
@@ -31,6 +32,8 @@ | |
from .forms import ReviewForm | ||
from ..models.storage_util import s3_root_storage | ||
|
||
MAX_OBJECTS = 1 | ||
|
||
|
||
class FileDownloadMixin: | ||
""" | ||
|
@@ -482,3 +485,12 @@ class RegistrantAdmin(admin.ModelAdmin): | |
|
||
class RegistrarAdmin(admin.ModelAdmin): | ||
model = Registrar | ||
|
||
|
||
class TimeFlagAdmin(admin.ModelAdmin): | ||
model = TimeFlag | ||
|
||
def has_add_permission(self, request): | ||
if self.model.objects.count() >= MAX_OBJECTS: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be False for any user as we do not want to add more entries? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we will need a seed script? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
up for discussion with Robert/Jim/Max I guess. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Done |
||
return False | ||
return super().has_add_permission(request) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Generated by Django 4.2.13 on 2024-07-19 13:16 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("request", "0010_alter_application_ministerial_request_evidence_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="TimeFlag", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("on_hold_days", models.IntegerField(default=5)), | ||
("to_close_days", models.IntegerField(default=60)), | ||
], | ||
), | ||
migrations.AlterField( | ||
model_name="application", | ||
name="status", | ||
field=models.CharField( | ||
choices=[ | ||
("approved", "Approved"), | ||
("rejected", "Rejected"), | ||
("in_progress", "In Progress"), | ||
("ready_2i", "Ready for 2i"), | ||
("more_information", "More Information"), | ||
("new", "New"), | ||
("on_hold", "On-hold"), | ||
("failed_confirmation_email", "Failed Confirmation Email"), | ||
("failed_decision_email", "Failed Decision Email"), | ||
], | ||
default="new", | ||
max_length=25, | ||
), | ||
), | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from django.db import models | ||
|
||
|
||
class TimeFlag(models.Model): | ||
""" | ||
An Admin can change the times on application status, defaults below | ||
1. More Information more than 5 days change to On-hold. | ||
2. On-hold more than 60 days change to Closed. | ||
""" | ||
|
||
on_hold_days = models.IntegerField(default=5) | ||
to_close_days = models.IntegerField(default=60) | ||
|
||
def __str__(self): | ||
return "More Information and On-hold flags" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to set the minute=0 otherwise it will run every minute at 0 hrs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hour=0, doing it once a day at midnight. But will ask Robert on Monday.