diff --git a/mainapp/urls.py b/mainapp/urls.py index fcd2a69fa..52b391996 100644 --- a/mainapp/urls.py +++ b/mainapp/urls.py @@ -62,5 +62,7 @@ path('consent_success/', views.ConsentSuccess.as_view(), name='consent_success'), url(r'c/(?P\d+)/(?P\d+)/$', views.VolunteerConsent.as_view(), name='volunteer_consent'), url('missing_and_finding_persons/', views.ReportFindPerson.as_view(), name='report_find_person'), - url('hospitals/', views.HospitalView.as_view(), name='hospitals') + url('hospitals/', views.HospitalView.as_view(), name='hospitals'), + url('announcements/api', views.announcement_api, name='announcements_api'), + ] diff --git a/mainapp/views.py b/mainapp/views.py index 227ef4187..54259f07e 100644 --- a/mainapp/views.py +++ b/mainapp/views.py @@ -35,6 +35,7 @@ from collections import OrderedDict + class CustomForm(forms.ModelForm): def __init__(self, *args, **kwargs): super(CustomForm, self).__init__(*args, **kwargs) @@ -978,3 +979,10 @@ class CollectionCenterView(CreateView): model = CollectionCenter form_class = CollectionCenterForm success_url = '/collection_centers/' + + +def announcement_api(request): + objects = Announcements.objects + data = list(objects.values()) + return JsonResponse({"announcements" : data}) + \ No newline at end of file