reobject
reobject copied to clipboard
Implement model relationships
Django-style many-to-many relationships is a highly desirable feature. There might be some refactoring involved in reobject.manager.Manager
.
class Publication(models.Model):
def __init__(self, title):
self.title = title
class Article(Model):
def __init__(self, headline):
self.publications = models.ManyToManyField(Publication)
self.headline = headline
ReObject should allow the following usages:
-
a.publications.all()
-
p.article_set.all()
-
a.publications.create(..)
-
a.publications.add(p)
-
Article.objects.filter(publications__title__startswith="Science")
-
Publication.objects.filter(article__headline__startswith="NASA")