Skip to content

DEP: Add event details on dref and field report#2708

Draft
sudip-khanal wants to merge 3 commits intoproject/dref-emergency-pagesfrom
feat/add-event-on-dref
Draft

DEP: Add event details on dref and field report#2708
sudip-khanal wants to merge 3 commits intoproject/dref-emergency-pagesfrom
feat/add-event-on-dref

Conversation

@sudip-khanal
Copy link
Copy Markdown
Contributor

Changes

  • Add event on Dref module and update the related api's to add event details
  • Add a script to migrate event to dref

Checklist

Things that should succeed before merging.

  • Updated/ran unit tests
  • Updated CHANGELOG.md

Release

If there is a version update, make sure to tag the repository with the latest version.

- Replace MiniEventSerializer to ListEventSerializer on FieldReportSerializer
- Add event filter on field report api
@sudip-khanal sudip-khanal changed the title DEP:Add event on dref DEP:Add event on dref and field report Apr 9, 2026
@sudip-khanal sudip-khanal changed the title DEP:Add event on dref and field report DEP: Add event details on dref and field report Apr 9, 2026
Copy link
Copy Markdown
Member

@susilnem susilnem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to do a catch up regarding the changes that has been done into this pull request.

districts_details = MiniDistrictSerializer(source="districts", many=True, read_only=True)
regions_details = RegionSerializer(source="regions", many=True, read_only=True)
event_details = MiniEventSerializer(source="event", read_only=True)
event_details = ListEventSerializer(source="event", read_only=True)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason on changing it to ListEventSerializer?

count += 1

Dref.objects.bulk_update(drefs, ["event"])
self.stdout.write(self.style.SUCCESS(f"Updated {count} Dref records with related Event"))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.stdout.write(self.style.SUCCESS(f"Updated {count} Dref records with related Event"))
updated_dref_count = Dref.objects.bulk_update(drefs, ["event"])
self.stdout.write(self.style.SUCCESS(f"Updated {updated_dref_count} Dref records with related Event"))


drefs = Dref.objects.exclude(appeal_code__isnull=True)
self.stdout.write(self.style.NOTICE(f"Total Dref records with appeal code:{drefs.count()}"))
count = 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
count = 0

event_id = appeal_map.get(dref.appeal_code)
if event_id:
dref.event = event_id
count += 1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
count += 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants