-
Notifications
You must be signed in to change notification settings - Fork 7
Update dref status #2551
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
base: project/dref-translation
Are you sure you want to change the base?
Update dref status #2551
Conversation
dref/migrations/0084_alter_dref_status_alter_dreffinalreport_status_and_more.py
Show resolved
Hide resolved
) | ||
def get_published(self, request, pk=None, version=None): | ||
dref = self.get_object() | ||
if dref.status != Dref.Status.FINALIZED: |
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.
We should add validation in serializer to enforce allowed status transitions for post and update. It's fine for publish api.
Draft-> FINALIZED.
FINALIZED-> draft
FINALIZED -> Approved
dref/serializers.py
Outdated
|
||
def get_unpublished_op_update_count(self, obj) -> int: | ||
return DrefOperationalUpdate.objects.filter(dref_id=obj.id, is_published=False).count() | ||
return DrefOperationalUpdate.objects.filter(dref_id=obj.id, status=Dref.Status.DRAFT).count() |
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.
return DrefOperationalUpdate.objects.filter(dref_id=obj.id, status=Dref.Status.DRAFT).count() | |
return DrefOperationalUpdate.objects.filter(dref_id=obj.id, status!=Dref.Status.APPROVED).count() |
dref/serializers.py
Outdated
|
||
def get_unpublished_final_report_count(self, obj) -> int: | ||
return DrefFinalReport.objects.filter(dref_id=obj.id, is_published=False).count() | ||
return DrefFinalReport.objects.filter(dref_id=obj.id, status=Dref.Status.DRAFT).count() |
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.
here
51f3e24
to
f31e649
Compare
89a6cb8
to
7bebad0
Compare
Addresses
Depends on
Changes
Checklist
Things that should succeed before merging.
Release
If there is a version update, make sure to tag the repository with the latest version.