Skip to content

Implement model relationships #5

Description

@onyb

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions