tehfink committed 1ea203a

added a model method: `get_name()` instead of passing the name in the plugin context

Comments (0)

Files changed (2)


         return super(CMSFaqEntryPlugin, self).get_form(request, obj, **kwargs)
     def render(self, context, instance, placeholder):
-        from django.template.defaultfilters import slugify
             'body': plugin_tags_to_user_html(instance.body, context, placeholder),
             'topic': instance.topic,
-            'name': slugify(instance.topic),
             'css': instance.get_css_display(),
             'placeholder': placeholder,
             'object': instance,


 from django.utils.text import truncate_words
 from cms.plugins.text.utils import plugin_admin_html_to_tags, plugin_tags_to_admin_html
 from django.conf import settings
+from django.template.defaultfilters import slugify
 #get custom css from settings or use default
     css = models.CharField(_('CSS class'), max_length=1, choices=CMSPLUGIN_FAQENTRY_CSS_CHOICES, blank=True, help_text=_('Additional CSS class to apply'))
     body = models.TextField(_("body"))
+    def get_name(self):
+        return slugify(self.topic)
     def _set_body_admin(self, text):
         self.body = plugin_admin_html_to_tags(text)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.