Skip to content

Commit da906dd

Browse files
committed
Refactor NGO account settings and forms
- update URLs and templates for better organization
1 parent ff38e51 commit da906dd

File tree

18 files changed

+516
-442
lines changed

18 files changed

+516
-442
lines changed

backend/donations/forms/ngo_account.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111

1212
class NgoPresentationForm(forms.Form):
13-
is_accepting_forms = forms.BooleanField(label=_("Is accepting forms"), required=False)
14-
1513
name = forms.CharField(label=_("Name"), max_length=255, required=True)
1614
if settings.ENABLE_FULL_VALIDATION_CUI:
1715
cif = ROCIFField(label=_("CUI/CIF"), required=True)
@@ -100,6 +98,8 @@ def clean_contact_phone(self):
10098

10199

102100
class NgoFormForm(forms.Form):
101+
is_accepting_forms = forms.BooleanField(label=_("Is accepting forms"), required=False)
102+
103103
slug = forms.CharField(label=_("Slug"), max_length=150, required=True)
104104
description = forms.CharField(label=_("Description"), widget=forms.Textarea, required=True)
105105

backend/donations/urls_ngo_account.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
NgoFormsView,
1010
NgoPresentationView,
1111
NgoRedirectionsView,
12-
NgoSettingsView,
12+
UserSettingsView,
1313
)
1414

1515
admin.site.site_header = f"Admin | {settings.VERSION_LABEL}"
@@ -23,6 +23,6 @@
2323
path("formulare/", NgoFormsView.as_view(), name="forms"),
2424
path("redirectionari/", NgoRedirectionsView.as_view(), name="redirections"),
2525
path("arhive/", NgoArchivesView.as_view(), name="archives"),
26-
path("settings/", NgoSettingsView.as_view(), name="settings"),
26+
path("setari-cont/", UserSettingsView.as_view(), name="settings-account"),
2727
path("arhiva/<job_id>/", ArchiveDownloadLinkView.as_view(), name="archive-download-link"),
2828
]

backend/donations/views/ngo_account.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ def post(self, request, *args, **kwargs):
213213
ngo.locality = form.cleaned_data["locality"]
214214
ngo.active_region = form.cleaned_data["active_region"]
215215

216-
ngo.is_accepting_forms = form.cleaned_data["is_accepting_forms"]
217216
ngo.display_email = form.cleaned_data["display_email"]
218217
ngo.display_phone = form.cleaned_data["display_phone"]
219218

@@ -309,6 +308,8 @@ def post(self, request, *args, **kwargs):
309308
ngo.bank_account = form.cleaned_data["iban"]
310309
ngo.description = form.cleaned_data["description"]
311310

311+
ngo.is_accepting_forms = form.cleaned_data["is_accepting_forms"]
312+
312313
if errors:
313314
return render(request, self.template_name, context)
314315

@@ -322,10 +323,10 @@ def post(self, request, *args, **kwargs):
322323
return render(request, self.template_name, context)
323324

324325

325-
class NgoSettingsView(NgoBaseTemplateView):
326-
template_name = "ngo-account/settings/main.html"
326+
class UserSettingsView(NgoBaseTemplateView):
327+
template_name = "ngo-account/settings-account/main.html"
327328
title = _("Organization settings")
328-
sidebar_item_target = "org-settings"
329+
sidebar_item_target = "user-settings"
329330

330331
def get_context_data(self, **kwargs):
331332
context = super().get_context_data(**kwargs)

0 commit comments

Comments
 (0)