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
django cms integration #1
Conversation
Excellent! I start reviewing it right now! |
""" | ||
if 'terms' in original_context: | ||
return rendered_content | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else
statement is useless. If 'terms' in original_context
is True
, you return something, which also means you leave this function. The else
is therefore verified each time it is parsed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok removed!
That's it! Do you have anything else to change, or can I merge your pull request? |
Fine, |
for cms_plugin_processor and TermsIndexPLugin
2ea5f2a fix README review |
render_template = "term_plugin.html" | ||
|
||
def render(self, context, instance, placeholder): | ||
terms = Term.objects.all() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized something: if you select every Term, you will also display those who have no definition but a link instead. So you either need to apply a .exclude(description='')
to this QuerySet or handle this (not so) special case in the template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO we should add link in the template, maybe a short version like
<dd>{{ term.definition|safe }} {{ term.url|urlizetrunc:15 }}</dd>
If there is a description, it will be add after. Else, it will be the only content.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good. Maybe a newline this time? Only if there is a url, of course. And maybe more letters shown in the urlizetrunc. Something like:
<dd>
{{ term.definition|safe }}
{% if term.url %}
<br/>
{{ term.url|urlizetrunc:40 }}
{% endif %}
</dd>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, if definition is empty and url not, the new line is still there.
Perhaps, but more complex :
{{ term.definition|safe }}
{% if term.url and term.definition %}<br/>{%endif %}
{{ term.url|urlizetrunc:40 }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yes. Sorry. Go on, I think this will be the last one before I merge all your changes.
django cms integration
Changes Unknown when pulling d70125f on jssevestre:master into * on BertrandBordage:master*. |
Hello
please see attached simple code to use django-terms with django-cms:
TermsProcessor
a context processor to parse all plugins output
TermsIndexPlugin
to display all terms on a page as
BR