{ "info": { "author": "Charles Leifer", "author_email": "coleifer@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "==========================\ndjango-generic-aggregation\n==========================\n\nannotate() and aggregate() for generically-related data. also a handy function\nfor filtering GFK-model querysets.\n\nUse django's `GenericRelation `_ where possible,\nas this can make the queries generated more efficient by using a JOIN rather\nthan a subquery.\n\n\ninstallation\n------------\n\n::\n\n # install from pypi\n pip install django-generic-aggregation\n \n # or install via git\n pip install -e git+git://github.com/coleifer/django-generic-aggregation.git#egg=generic_aggregation\n\n\nexamples\n--------\n\nThe examples below assume the following simple models:\n\n::\n\n class Rating(models.Model):\n rating = models.IntegerField()\n object_id = models.IntegerField()\n content_type = models.ForeignKey(ContentType)\n content_object = GenericForeignKey(ct_field='content_type', fk_field='object_id')\n \n class Food(models.Model):\n name = models.CharField(max_length=50)\n ratings = generic.GenericRelation(Rating) # reverse generic relation\n\n\nYou want to figure out which items are highest rated (generic_annotate)\n\n::\n\n from django.db.models import Avg\n \n food_qs = Food.objects.filter(name__startswith='a')\n generic_annotate(food_qs, Rating, Avg('ratings__rating'))\n \n # you can mix and match queryset / model\n generic_annotate(food_qs, Rating.objects.all(), Avg('ratings__rating'))\n\nYou want the average rating for all foods that start with 'a' (generic_aggregate)\n\n::\n\n food_qs = Food.objects.filter(name__startswith='a')\n generic_aggregate(food_qs, Rating, Avg('ratings__rating'))\n\nYou want to only display ratings for foods that start with 'a' (generic_filter)\n\n food_qs = Food.objects.filter(name__startswith='a')\n generic_filter(Rating.objects.all(), food_qs)\n\n\ndocumentation\n-------------\n\nhttp://django-generic-aggregation.readthedocs.org/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/coleifer/django-generic-aggregation/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-generic-aggregation", "package_url": "https://pypi.org/project/django-generic-aggregation/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-generic-aggregation/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/coleifer/django-generic-aggregation/" }, "release_url": "https://pypi.org/project/django-generic-aggregation/0.4.0/", "requires_dist": null, "requires_python": null, "summary": "annotate() and aggregate() for generically related data", "version": "0.4.0" }, "last_serial": 1917388, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "a627077e837cd9235cc2bb63defd779b", "sha256": "7e4340f7e0d9614d5f328550b59695d8c9254f928dae7a42a815cd6bf27ccae4" }, "downloads": -1, "filename": "django-generic-aggregation-0.1.1.tar.gz", "has_sig": false, "md5_digest": "a627077e837cd9235cc2bb63defd779b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4897, "upload_time": "2010-10-19T05:27:28", "url": "https://files.pythonhosted.org/packages/c6/e0/b4eb75e84da563dc462803b69af0ec0504adc30c73539bce9255ba42fc43/django-generic-aggregation-0.1.1.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "29a244bf2b2e5ecc66748ada934e21ce", "sha256": "f43a353cdd37c2c5ab0d97ed01443d202c2e4d6136d42d003fa68484fa73bcf0" }, "downloads": -1, "filename": "django-generic-aggregation-0.2.0.tar.gz", "has_sig": false, "md5_digest": "29a244bf2b2e5ecc66748ada934e21ce", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4727, "upload_time": "2012-05-02T03:15:08", "url": "https://files.pythonhosted.org/packages/44/3c/86bc56c1527442e993842b3e1ae0da2ae37a65fded8343be94e503fcbd7d/django-generic-aggregation-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "ec61735e64aefe1cb905dd259b779f6c", "sha256": "8be32f2141c7148a54c70a73bc1fbcc41c459288b7da26e64dd0e6aff2a0e9c2" }, "downloads": -1, "filename": "django-generic-aggregation-0.3.0.tar.gz", "has_sig": false, "md5_digest": "ec61735e64aefe1cb905dd259b779f6c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6244, "upload_time": "2012-05-02T18:22:04", "url": "https://files.pythonhosted.org/packages/55/d8/58a7fb3ae1e87050a926573a2a708488b9c075ec53e6b3584bb4083da2ad/django-generic-aggregation-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "e2262c279e2d80b88c22e268636109ed", "sha256": "e5b48520fe6916701febf3d4c079863c846d3847a633eea92031f395cf8340fa" }, "downloads": -1, "filename": "django-generic-aggregation-0.3.1.tar.gz", "has_sig": false, "md5_digest": "e2262c279e2d80b88c22e268636109ed", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6482, "upload_time": "2012-05-02T22:32:52", "url": "https://files.pythonhosted.org/packages/f7/45/b846b7c2fbc0a8543ff065b772fcc9e946808b9ce839bbee7a68a6e463ae/django-generic-aggregation-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "8e726545e4bbd6a3745707d9ff80318a", "sha256": "09ba92520fc8f4c4dbd4b8851f508fb221e4372e76b258ded64cfbcbdda46574" }, "downloads": -1, "filename": "django-generic-aggregation-0.3.2.tar.gz", "has_sig": false, "md5_digest": "8e726545e4bbd6a3745707d9ff80318a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7299, "upload_time": "2013-03-27T03:31:22", "url": "https://files.pythonhosted.org/packages/ed/e9/fff23e6c8769cc4fc2f8924f47a313b76774ccfe685412197658bfc29d8e/django-generic-aggregation-0.3.2.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "ab423b63bb05202c17b5b9a84bcb3b5d", "sha256": "8cd40ab7d999dc20ffe853cd5770b3273d1611f26295c8932df31f1c6b48a72a" }, "downloads": -1, "filename": "django-generic-aggregation-0.4.0.tar.gz", "has_sig": false, "md5_digest": "ab423b63bb05202c17b5b9a84bcb3b5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7152, "upload_time": "2016-01-22T15:04:28", "url": "https://files.pythonhosted.org/packages/81/94/39b57c166613d2b7dcbc31e22672f13bfe9438e332d6e106899728b8a2bc/django-generic-aggregation-0.4.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ab423b63bb05202c17b5b9a84bcb3b5d", "sha256": "8cd40ab7d999dc20ffe853cd5770b3273d1611f26295c8932df31f1c6b48a72a" }, "downloads": -1, "filename": "django-generic-aggregation-0.4.0.tar.gz", "has_sig": false, "md5_digest": "ab423b63bb05202c17b5b9a84bcb3b5d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7152, "upload_time": "2016-01-22T15:04:28", "url": "https://files.pythonhosted.org/packages/81/94/39b57c166613d2b7dcbc31e22672f13bfe9438e332d6e106899728b8a2bc/django-generic-aggregation-0.4.0.tar.gz" } ] }