Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement model relationships #5

Open
onyb opened this issue Feb 10, 2017 · 0 comments
Open

Implement model relationships #5

onyb opened this issue Feb 10, 2017 · 0 comments

Comments

@onyb
Copy link
Owner

onyb commented Feb 10, 2017

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 onyb self-assigned this Feb 10, 2017
@onyb onyb removed their assignment Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant