Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Mailbox): Integrate django-autoslug and update Mailbox model with AutoSlugField #17

Merged
merged 2 commits into from
Sep 8, 2024

Conversation

MohmdFo
Copy link
Contributor

@MohmdFo MohmdFo commented Sep 8, 2024

  • Added django-autoslug package to the project dependencies.
    - Updated pyproject.toml and poetry.lock to include the new package.

    • Modified Mailbox model in sage_mailbox/models/mailbox.py:

      • Replaced the existing slug field with AutoSlugField from django-autoslug.
      • Configured AutoSlugField to automatically convert periods (.) to hyphens (-) in slugs for better URL compatibility.
    • Updated sage_mailbox/admin/mailbox.py:

      • Ensured the admin interface reflects the changes in the Mailbox model, particularly the use of AutoSlugField for gener
        ating slugs.

    closes Improve Slug Generation for Mailbox Model by Replacing Periods (.) with Hyphens (-) #16.

- Added handling for "_save" action in `response_add` and `response_change` methods to improve redirection behavior.
- Modified `response_add` to redirect to the changelist page after saving a new model, if the "_save" button is pressed.
- Modified `response_change` to redirect to the changelist page after saving changes to an existing model, if the "_save" button is pressed.
- This change ensures a smoother user experience by preventing issues related to double flash messages in the Django admin interface.
…h AutoSlugField

- Added `django-autoslug` package to the project dependencies.
  - Updated `pyproject.toml` and `poetry.lock` to include the new package.

- Modified `Mailbox` model in `sage_mailbox/models/mailbox.py`:
  - Replaced the existing slug field with `AutoSlugField` from `django-autoslug`.
  - Configured `AutoSlugField` to automatically convert periods (.) to hyphens (-) in slugs for better URL compatibility.

- Updated `sage_mailbox/admin/mailbox.py`:
  - Ensured the admin interface reflects the changes in the `Mailbox` model, particularly the use of `AutoSlugField` for generating slugs.

closes sageteamorg#16.
@sepehr-akbarzadeh sepehr-akbarzadeh merged commit 2a4fe15 into sageteamorg:main Sep 8, 2024
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve Slug Generation for Mailbox Model by Replacing Periods (.) with Hyphens (-)
2 participants