diff --git a/migrations/0057_alter_supporter_internal_notes.py b/migrations/0057_alter_supporter_internal_notes.py new file mode 100644 index 0000000..5e7a96e --- /dev/null +++ b/migrations/0057_alter_supporter_internal_notes.py @@ -0,0 +1,35 @@ +# Generated by Django 4.2.16 on 2024-11-13 16:21 + +import core.model_utils +from django.db import migrations +from django.template.defaultfilters import linebreaksbr + + +def linebreaks_to_brs_in_internal_notes(apps, schema_editor): + Supporter = apps.get_model('consortial_billing', 'Supporter') + for supporter in Supporter.objects.all(): + new_notes = linebreaksbr(supporter.internal_notes) + supporter.internal_notes = new_notes + supporter.save() + + +class Migration(migrations.Migration): + + dependencies = [ + ('consortial_billing', '0056_remove_supporter_country'), + ] + + operations = [ + migrations.AlterField( + model_name='supporter', + name='internal_notes', + field=core.model_utils.JanewayBleachField( + blank=True, + help_text='Internal notes on this supporter', + ), + ), + migrations.RunPython( + linebreaks_to_brs_in_internal_notes, + reverse_code=migrations.RunPython.noop, + ) + ] diff --git a/models.py b/models.py index 33353ca..cfe3562 100755 --- a/models.py +++ b/models.py @@ -15,6 +15,7 @@ from plugins.consortial_billing import utils, logic, plugin_settings +from core.model_utils import JanewayBleachField from utils.logger import get_logger logger = get_logger(__name__) @@ -508,8 +509,7 @@ class Supporter(models.Model): help_text="Whether the supporter is active", ) - internal_notes = models.TextField( - max_length=500, + internal_notes = JanewayBleachField( blank=True, help_text="Internal notes on this supporter", ) diff --git a/templates/consortial_billing/supporter_list_item.html b/templates/consortial_billing/supporter_list_item.html index 9791743..a70fb42 100644 --- a/templates/consortial_billing/supporter_list_item.html +++ b/templates/consortial_billing/supporter_list_item.html @@ -47,7 +47,9 @@

{% endif %}
Internal notes -

{{ supporter.internal_notes|linebreaks }}

+
+ {{ supporter.internal_notes|safe }} +