On 11/21/05, Simon Willison <[EMAIL PROTECTED]> wrote:

> This is yet another case for some kind of mixin functionality.
> Inheritance isn't really suitable for this because there are various
> kinds of functionality we might want to add to a model, and multiple
> inheritance is ugly. We really want something like:
>
> class Article(meta.Model):
>    class Mixins:
>      site = SiteMixin()
>      taggable = TaggableMixin()
>      searchable = FullTextSearchMixin('headline', 'body')
>

you can achieve the other 2 specialized fields, and you dont' need
mixins for them.

see http://svn.zilbo.com/svn/django/snippets/tag.py for an example of
it being done for tagging, or how hugo has implemented it
https://simon.bofh.ms/django-projects/stuff/trunk/tagging/utils.py

the difference with the 'site' is that effects all the queries, as it
is a kind of dynamic filter, as it affects ALL sql queries. and
inheritance would work well here.

another possibility would be for row-level authorizations.


> etc.
>
> Cheers,
>
> Simon
>
>


--
[EMAIL PROTECTED] -- ++61-3-9877-0909
If everything seems under control, you're not going fast enough. -
Mario Andretti

Reply via email to