On 5/23/2009 5:13 AM, Jani Tiainen wrote: > I'm designing application (site) that is supposed to rely heavily on > pluings. > > i didn't found much of references how I can create plugin that can > provide something useful for my main template. something like: > > myplugin.py: > > provide_link = "<a href="{% url myplugin.views.linkaction %}">MyPlugin</a>" > > And then in my "core" application template: > templates/mycore/mycore.html: > > {% for plugin in allplugins %}{{ plugin.provide_link }}{% endfor %} > > Any pointers to such apps or snippets that uses this (or similiar) > tehcnique would be appreciated.
Well, if you break down the problem, it really is just two things: 1. Registry 2. Interface Registry ======== The registry takes care of the part that when you create a new plugin, it should be registered somehow as a plugin. Django itself is full of this pattern: models, template tags, filters, admin sites, databrowse, serialization, etc. You can look to those for ideas and inspirations. The most sophisticated being the models which relies on a metaclass to do its implicit registration magic. Interface ========= This is really internal to the specific plugin domain, so depending on your needs, you can enforce it a number of ways: simple documentation of the superclass, putting in a stub of NotImplemented, etc. -- George --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---