Files
offline-db/patch_user_bio.py
8d52f8c77a Add user bio field and validate profile updates (#322)
- Add `bio` (TextField) to `User` model.
- Extend `UserProfileAPIView` `patch` method to handle profile updates.
- Sanitize `bio` input using `bleach.clean` to prevent XSS.
- Validate `username` to allow only alphanumeric characters, underscores, and hyphens.
- Add comprehensive test cases in `test_profile_view.py`.
- Apply migrations.
- Mark relevant items as completed in `.jules/development-plan.md`.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Senpai-YoloBot <41898282+github-actions[bot]@users.noreply.github.com>
2026-03-22 12:25:48 +00:00

14 lines
423 B
Python

import re
with open('users/models.py', 'r') as f:
content = f.read()
new_content = re.sub(
r'is_premium = models.BooleanField\(default=False, verbose_name=_\("Premium Status"\)\)',
'is_premium = models.BooleanField(default=False, verbose_name=_("Premium Status"))\n bio = models.TextField(blank=True, verbose_name=_("Bio"))',
content
)
with open('users/models.py', 'w') as f:
f.write(new_content)