On Dec 17, 2005, at 6:09 AM, Robert Wittams wrote:
I really don't like this. It is *not extensible* from the outside. The
point about just having things in your class that are able to add
to it
is that it just works like this anyway (it would be harder to forbid
it). The TagCollection etc can be completely third party, and only
provided in django.contrib as an app - the base system knows nothing
about it. Just think how crazy it would be to have support for every
random extension in META.
No, the whole point is to write a system for adding extensions to
META. The problem currently is that a model's options aren't
extensible; my idea keeps metadata with metadata. Yes, the example
options we're talking about here *are* field-like, but I can think of
lots of plugins that would add behavior that's not field-related.
What about a behavior that modifies an object to use a RDF store
instead of a database? Or what about a "write_only" behavior that
disallows modification of existing rows? Or...
None of that stuff is really suitable for adding into Django at the
core, so I want a way of adding it as a plugin.
The idea is that the class creation stuff becomes understandable, and
tractable, to almost all developers. Rather than thinking "ok, each
attribute is a database field in a table", they will think "ok, each
attribute does something to build up this class".
That's a very good point.
However, I still think there's a value in clarity. Consider::
class Something(Model):
name = CharField(maxlength=100)
dummy = WriteOnly()
versus:
class Something(Model):
name = CharField(maxlength=100)
class META:
write_only = True
See what I'm talking about?
It's like in HTML: <script> tags are allowed anywhere, but I try to
keep them in the <head> because metadata belongs with other metadata.
class BEHAVIOUR:
tags = TagCollection()
comments = CommentCollection()
acls = ACLCollection()
Yeah, I don't like this, either.
The really funny thing about this: All of the examples I gave are at
least as field-like as the existing ManyToMany field.
True -- but not all the possibilities are field-related. My examples
above are totally arbitrary, but hopefully I've made the point that
there's room for extra behavior that's not field-related.
Jacob