I'm wondering if there is any community interest in adding a model of
relations in the ContentType framework?
We had many Institutions in our database that represented the same
object. I wrote an add-on to the admin changelist to merge
institutions. I tried to write the merge in a general way; it was
possible, but it depends on the internals of django.db.models.options,
which are none to pretty, and presumably subject to change.
I'm wondering if it wouldn't be useful to have a Relation (or
"ContentRelation"?) class as part of the contenttypes framework, which
would store information about relations between database models with a
simple public interface.
I have a few other projects on my plate that could immediately make
use of it: schema evolution and garbage collection. I think that a bit
more introspection capability can be usefully added to the ORM in a
fairly simple way.
Briefly, Relation might look something like this:
class Relation( models.Model ):
source = models.ForeignKey( ContentType )
target = models.ForeignKey( ContentType )
relation_type = models.IntegerField(
choices = ( ( 1, 'one-to-many' ), ( 2, 'one-to-one' ), ( 3,
'many-to-many' ) ) )
is_inheritance = models.BooleanField()
source_accessor = models.CharField( max_length = 512 )
target_accessor = models.CharField( max_length = 512 )
Is this an interesting idea? Any advice on the details? If there is
some enthusiasm, I willing to publish to a fork....
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.