reobject icon indicating copy to clipboard operation
reobject copied to clipboard

Implement model relationships

Open onyb opened this issue 8 years ago • 0 comments

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")

onyb avatar Feb 10 '17 10:02 onyb