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

Allow content edit and translation #162

Merged
merged 1 commit into from
Jun 3, 2019
Merged

Conversation

jraddaoui
Copy link
Collaborator

@jraddaoui jraddaoui commented May 31, 2019

  • Create Content model with key and content fields.
  • Use django-modeltranslation to allow content field translation.
  • Add initial content for "home", "login" and "faq" pages.
  • Use numbered keys to order them and add labels for display.
  • Add content page to manage them in a formset.
  • Render content, allowing Markdown syntax.

Refs #96, #105.

@jraddaoui jraddaoui self-assigned this May 31, 2019
@codecov
Copy link

codecov bot commented Jun 1, 2019

Codecov Report

Merging #162 into master will increase coverage by 0.82%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master     #162      +/-   ##
==========================================
+ Coverage   85.64%   86.46%   +0.82%     
==========================================
  Files          31       34       +3     
  Lines        1219     1271      +52     
==========================================
+ Hits         1044     1099      +55     
+ Misses        175      172       -3
Impacted Files Coverage Δ
scope/urls.py 100% <ø> (ø) ⬆️
scope/settings.py 100% <ø> (ø) ⬆️
dips/templatetags/custom_tags.py 100% <100%> (ø) ⬆️
dips/migrations/0009_content.py 100% <100%> (ø)
dips/models.py 98.65% <100%> (+0.05%) ⬆️
dips/translation.py 100% <100%> (ø)
dips/migrations/0010_initial_content.py 100% <100%> (ø)
dips/forms.py 86.74% <100%> (+0.84%) ⬆️
dips/views.py 94.93% <100%> (+0.14%) ⬆️
... and 3 more

@jraddaoui jraddaoui force-pushed the dev/issue-96-static-content branch 2 times, most recently from 16f75cf to 1b497f6 Compare June 2, 2019 02:11
@jraddaoui jraddaoui requested review from cole and sevein June 2, 2019 02:26

class StaticContent(models.Model):
key = models.CharField(max_length=50, primary_key=True)
content = models.TextField(_("content"), blank=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jraddaoui , wouldn't be a good idea to have the model mapped out after the concept of a "Page"? E.g. a model where you can also fit the title of the page or in the future things like its permalink? Or you're thinking on something more generic?

Copy link
Collaborator Author

@jraddaoui jraddaoui Jun 3, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point @sevein! I didn't go that way because some of the contents are added as part of a page, where other elements already exist. There are some follow-ups in #96 about those "static content" sections.

@jraddaoui jraddaoui force-pushed the dev/issue-96-static-content branch from 1b497f6 to eed005c Compare June 3, 2019 15:45
@jraddaoui jraddaoui changed the title Allow static content edit and translation Allow content edit and translation Jun 3, 2019
Copy link
Contributor

@cole cole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @jraddaoui! Some comments inline, but this code looks good generally.

dips/tests/test_migrations.py Show resolved Hide resolved
dips/models.py Show resolved Hide resolved
dips/models.py Show resolved Hide resolved
dips/templatetags/custom_tags.py Outdated Show resolved Hide resolved
@jraddaoui jraddaoui force-pushed the dev/issue-96-static-content branch 2 times, most recently from 3d64f0a to 4de6423 Compare June 3, 2019 17:17
@jraddaoui
Copy link
Collaborator Author

Thank you very much @cole! Back to you ;)

Copy link
Contributor

@cole cole left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

- Create Content model with key and content fields.
- Use `django-modeltranslation` to allow content field translation.
- Add initial content for "home", "login" and "faq" pages.
- Use numbered keys to order them and add labels for display.
- Add content page to manage them in a formset.
- Render content, allowing Markdown syntax.
@jraddaoui jraddaoui force-pushed the dev/issue-96-static-content branch from 4de6423 to 2d1cbc3 Compare June 3, 2019 17:38
@jraddaoui jraddaoui merged commit 2d1cbc3 into master Jun 3, 2019
@jraddaoui jraddaoui deleted the dev/issue-96-static-content branch June 3, 2019 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants