{"id":18581731,"url":"https://github.com/jpablo/django-orm-lambdas","last_synced_at":"2025-05-16T04:08:09.038Z","repository":{"id":68198764,"uuid":"1852209","full_name":"jpablo/django-orm-lambdas","owner":"jpablo","description":"A LINQ-esque Manager for Django models","archived":false,"fork":false,"pushed_at":"2011-06-29T18:11:05.000Z","size":100,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-26T17:08:57.976Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jpablo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-06-05T23:13:30.000Z","updated_at":"2018-04-11T21:01:35.000Z","dependencies_parsed_at":"2023-02-20T20:50:23.187Z","dependency_job_id":null,"html_url":"https://github.com/jpablo/django-orm-lambdas","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpablo%2Fdjango-orm-lambdas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpablo%2Fdjango-orm-lambdas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpablo%2Fdjango-orm-lambdas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jpablo%2Fdjango-orm-lambdas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jpablo","download_url":"https://codeload.github.com/jpablo/django-orm-lambdas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239321400,"owners_count":19619697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T00:06:55.563Z","updated_at":"2025-02-17T16:19:44.989Z","avatar_url":"https://github.com/jpablo.png","language":"Python","readme":"# LambdaManager\n\nLambdaManager extends the regular django.db.models.Manager with one function:\n\n```python\nwhere(lambda x: ...)\n```\n\n\nthat can be used like this:\n\n## Example\n\n```python\n# in models.py:\n\nfrom django.db import models\nfrom lambda_manager import LambdaManager\n\nclass Poll(models.Model):\n    question = models.CharField(max_length=200)\n    pub_date = models.DateTimeField('date published')\n\n    objects = LambdaManager()\n\nclass Choice(models.Model):\n    poll = models.ForeignKey(Poll)\n    choice = models.CharField(max_length=200)\n    votes = models.IntegerField()\n    anumber = models.IntegerField()\n\n    objects = LambdaManager()\n\n```\n\n```python\n# elsewhere:\n\nfrom models import Choice\n\nChoice.objects.where(lambda c: c.votes \u003e= 1)\nChoice.objects.where(lambda c: c.votes != 1)\nChoice.objects.where(lambda c: c.poll.question.exact('aaa'))\nChoice.objects.where(lambda c: c.poll.question.contains('aa'))\nChoice.objects.where(lambda c: c.votes == c.anumber)\nChoice.objects.where(lambda c: c.votes \u003e c.anumber)\nChoice.objects.where(lambda x: x.votes \u003c x.votes + 1)\nChoice.objects.where(lambda x: x.votes \u003c x.votes + x.votes + 2)\n```\n\n\n\n\n## TODO:\n\nImplement other arithmetic operators: *, -, /\n\n```python\nEntry.objects.filter(n_comments__gt=F('n_pingbacks') * 2)\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpablo%2Fdjango-orm-lambdas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjpablo%2Fdjango-orm-lambdas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjpablo%2Fdjango-orm-lambdas/lists"}