Skip to content

Commit c85b3fb

Browse files
authored
Merge pull request #15 from Xpirix/fix_notable_fixes_table
Add management command to fix broken entries
2 parents b3e4d79 + 8324ded commit c85b3fb

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ python manage.py update-versions-release-date
8888
# Exit the shell with CTRL+D
8989
```
9090

91+
To fix display issues with entries (notable fixes tables...), run:
92+
93+
```
94+
make uwsgi-shell
95+
python manage.py fix_broken_entries
96+
# Exit the shell with CTRL+D
97+
```
98+
9199
**intercom.io**
92100

93101
If you wish to make use of [intercom.io](https://www.intercom.io), include a
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from django.core.management.base import BaseCommand
2+
from changes.models import Entry
3+
4+
5+
class Command(BaseCommand):
6+
help = 'Fix broken entries by removing <p> and </p> tags from descriptions'
7+
8+
def handle(self, *args, **kwargs):
9+
entries = Entry.objects.all()
10+
for entry in entries:
11+
if entry.description and '<p>' in entry.description:
12+
entry.description = entry.description.replace('<p>', '').replace('</p>', '')
13+
entry.save()
14+
self.stdout.write(self.style.SUCCESS('Successfully fixed broken entries'))

0 commit comments

Comments
 (0)