Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/hypha-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
.venv/bin/python manage.py makemigrations --dry-run --verbosity=3
.venv/bin/python manage.py makemigrations --check

- name: Run django checks
- name: Run django collectstatic
if: matrix.group == 2
run: |
.venv/bin/python manage.py collectstatic --noinput --no-post-process --verbosity=1
Expand Down
3 changes: 0 additions & 3 deletions docs/setup/deployment/production/stand-alone.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,6 @@ SERVER_EMAIL: [email protected]
ANYMAIL_WEBHOOK_SECRET: [KEY]
AWS_ACCESS_KEY_ID: [KEY]
AWS_DEFAULT_ACL: None
AWS_MIGRATION_ACCESS_KEY_ID: [KEY]
AWS_MIGRATION_BUCKET_NAME: backup.example.org
AWS_MIGRATION_SECRET_ACCESS_KEY: [KEY]
AWS_PRIVATE_BUCKET_NAME: private.example.org
AWS_PUBLIC_BUCKET_NAME: public.example.org
AWS_PUBLIC_CUSTOM_DOMAIN: public.example.org
Expand Down
6 changes: 6 additions & 0 deletions hypha/apply/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from wagtail.users.apps import WagtailUsersAppConfig


class CustomUsersAppConfig(WagtailUsersAppConfig):
user_viewset = "hypha.apply.users.admin_views.CustomUserViewSet"
group_viewset = "hypha.apply.users.admin_views.CustomGroupViewSet"
1 change: 0 additions & 1 deletion hypha/apply/determinations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class Meta:
form_fields = StreamField(
DeterminationCustomFormFieldsBlock(),
default=[],
use_json_field=True,
)

@property
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/funds/models/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ApplicationForm(models.Model):
wagtail_reference_index_ignore = True

name = models.CharField(max_length=255)
form_fields = StreamField(ApplicationCustomFormFieldsBlock(), use_json_field=True)
form_fields = StreamField(ApplicationCustomFormFieldsBlock())

panels = [
FieldPanel("name"),
Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/funds/models/submissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ class ApplicationSubmission(
metaclass=ApplicationSubmissionMetaclass,
):
form_data = models.JSONField(encoder=StreamFieldDataEncoder)
form_fields = StreamField(ApplicationCustomFormFieldsBlock(), use_json_field=True)
form_fields = StreamField(ApplicationCustomFormFieldsBlock())
public_id = models.CharField(
max_length=255, null=True, blank=True, unique=True, db_index=True
)
Expand Down
4 changes: 3 additions & 1 deletion hypha/apply/funds/templates/funds/admin/parent_chooser.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ <h2>{% blocktrans %}Choose a Fund{% endblocktrans %}</h2>
{% csrf_token %}

<ul class="fields">
{% include "wagtailadmin/shared/field_as_li.html" with field=form.parent_page %}
<li>
{% include "wagtailadmin/shared/field.html" with field=form.parent_page %}
</li>
<li>
<button type="submit" class="button">{% trans 'Continue' %}</button>
</li>
Expand Down
10 changes: 3 additions & 7 deletions hypha/apply/projects/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,7 @@ class Project(BaseStreamForm, AccessFormData, models.Model):
status = models.TextField(choices=PROJECT_STATUS_CHOICES, default=DRAFT)

form_data = models.JSONField(encoder=StreamFieldDataEncoder, default=dict)
form_fields = StreamField(
ProjectFormCustomFormFieldsBlock(), null=True, use_json_field=True
)
form_fields = StreamField(ProjectFormCustomFormFieldsBlock(), null=True)

# tracks read/write state of the Project
is_locked = models.BooleanField(default=False)
Expand Down Expand Up @@ -500,14 +498,12 @@ class ProjectSOW(BaseStreamForm, AccessFormData, models.Model):
Project, related_name="sow", on_delete=models.CASCADE
)
form_data = models.JSONField(encoder=StreamFieldDataEncoder, default=dict)
form_fields = StreamField(
ProjectFormCustomFormFieldsBlock(), null=True, use_json_field=True
)
form_fields = StreamField(ProjectFormCustomFormFieldsBlock(), null=True)


class ProjectBaseStreamForm(BaseStreamForm, models.Model):
name = models.CharField(max_length=255)
form_fields = StreamField(ProjectFormCustomFormFieldsBlock(), use_json_field=True)
form_fields = StreamField(ProjectFormCustomFormFieldsBlock())

panels = [
FieldPanel("name"),
Expand Down
1 change: 0 additions & 1 deletion hypha/apply/projects/reports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class Report(BaseStreamForm, AccessFormData, models.Model):
form_fields = StreamField(
# Re-use the Project Custom Form class. The original fields (used at the time of response) should be required.
ProjectFormCustomFormFieldsBlock(),
use_json_field=True,
null=True,
)
form_data = models.JSONField(encoder=StreamFieldDataEncoder, default=dict)
Expand Down
18 changes: 9 additions & 9 deletions hypha/apply/projects/reports/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,35 +158,35 @@ def test_past_due(self):
"""Test that past_due_reports includes overdue reports."""
report = ReportFactory(past_due=True)
config = report.project.report_config
self.assertQuerysetEqual(
self.assertQuerySetEqual(
config.past_due_reports(), [report], transform=lambda x: x
)

def test_past_due_has_drafts(self):
"""Test that past_due_reports includes draft reports."""
report = ReportFactory(past_due=True, is_draft=True)
config = report.project.report_config
self.assertQuerysetEqual(
self.assertQuerySetEqual(
config.past_due_reports(), [report], transform=lambda x: x
)

def test_past_due_no_submitted(self):
"""Test that past_due_reports excludes submitted reports."""
report = ReportFactory(is_submitted=True, past_due=True)
config = report.project.report_config
self.assertQuerysetEqual(config.past_due_reports(), [], transform=lambda x: x)
self.assertQuerySetEqual(config.past_due_reports(), [], transform=lambda x: x)

def test_past_due_no_future(self):
"""Test that past_due_reports excludes future reports."""
report = ReportFactory(end_date=self.today + relativedelta(days=1))
config = report.project.report_config
self.assertQuerysetEqual(config.past_due_reports(), [], transform=lambda x: x)
self.assertQuerySetEqual(config.past_due_reports(), [], transform=lambda x: x)

def test_past_due_no_skipped(self):
"""Test that past_due_reports excludes skipped reports."""
report = ReportFactory(skipped=True, past_due=True)
config = report.project.report_config
self.assertQuerysetEqual(config.past_due_reports(), [], transform=lambda x: x)
self.assertQuerySetEqual(config.past_due_reports(), [], transform=lambda x: x)


class TestReport(TestCase):
Expand Down Expand Up @@ -232,19 +232,19 @@ def test_start_date_with_submitted(self):
def test_queryset_done_includes_submitted(self):
"""Test that done() queryset includes submitted reports."""
report = ReportFactory(is_submitted=True)
self.assertQuerysetEqual(Report.objects.done(), [report], transform=lambda x: x)
self.assertQuerySetEqual(Report.objects.done(), [report], transform=lambda x: x)

def test_queryset_done_includes_skipped(self):
"""Test that done() queryset includes skipped reports."""
report = ReportFactory(skipped=True)
self.assertQuerysetEqual(Report.objects.done(), [report], transform=lambda x: x)
self.assertQuerySetEqual(Report.objects.done(), [report], transform=lambda x: x)

def test_queryset_done_doesnt_includes_draft(self):
"""Test that done() queryset excludes draft reports."""
ReportFactory(is_draft=True)
self.assertQuerysetEqual(Report.objects.done(), [], transform=lambda x: x)
self.assertQuerySetEqual(Report.objects.done(), [], transform=lambda x: x)

def test_queryset_done_doesnt_includes_to_do(self):
"""Test that done() queryset excludes to-do reports."""
ReportFactory()
self.assertQuerysetEqual(Report.objects.done(), [], transform=lambda x: x)
self.assertQuerySetEqual(Report.objects.done(), [], transform=lambda x: x)
11 changes: 7 additions & 4 deletions hypha/apply/review/forms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django import forms
from django.core.exceptions import NON_FIELD_ERRORS
from django.utils.html import escape
from django.utils.safestring import mark_safe

from hypha.apply.review.options import NA
from hypha.apply.stream_forms.forms import StreamBaseForm
Expand Down Expand Up @@ -113,10 +114,12 @@ def calculate_score(self, data):
class SubmitButtonWidget(forms.Widget):
def render(self, name, value, attrs=None, renderer=None):
disabled = "disabled" if attrs.get("disabled") else ""
return '<input type="submit" name="{name}" value="{value}" class="btn btn-primary" {disabled}>'.format(
disabled=disabled,
name=escape(name),
value=escape(name.title()),
return mark_safe(
'<input type="submit" name="{name}" value="{value}" class="btn btn-primary" {disabled}>'.format(
disabled=disabled,
name=escape(name),
value=escape(name.title()),
)
)


Expand Down
2 changes: 1 addition & 1 deletion hypha/apply/review/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ReviewFormFieldsMixin(models.Model):
class Meta:
abstract = True

form_fields = StreamField(ReviewCustomFormFieldsBlock(), use_json_field=True)
form_fields = StreamField(ReviewCustomFormFieldsBlock())

@property
def score_fields(self):
Expand Down
Loading
Loading