{ "info": { "author": "Mathijs de Bruin", "author_email": "drbob@dokterbob.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Affero General Public License v3", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Utilities" ], "description": "=================\nDjango Popularity\n=================\nGeneric view- and popularity tracking pluggable for Django\n----------------------------------------------------------\n\nWhat is it?\n===========\nThe pluggable django-popularity makes it very easy to track the amount of\nviews for objects, and generate (generic) popularity listings based upon that.\n\nRight now it has a measure for view counts, relative view counts, novelty and\npopularity for ''all'' possible objects. \n\nStatus\n======\nThis app is currently being used in several small-scale production environments.\nHowever, it is probably that it still has a few kinks here and there and a fair bit\nof functionality is still undocumented. \n\nRequirements\n============\nShort answer: MySQL >= 4.1.1, Django >= 1.1\n\nLong answer:\nCurrently, this has only been tested for MySQL, thought it might work for Postgres and others as well (though SQLite might make some trouble out of it). If you do manage to get it to work (with or without modifications), please let me know so other users can profit from it as well.\n\nIn time, I am planning to migrate most of the functionality to pure-Django QuerySet babble. Sadly enough, the required functionality in the Django API\nis as of now not yet mature enough.\n\nInstallation\n============\n#) Get it from the Cheese Shop::\n \n\teasy_install django-popularity\n \n **Or** get the latest & greatest from Github and link it to your\n application tree::\n \n\tgit clone git://github.com/dokterbob/django-popularity.git\n\tln -s django-popularity/popularity $PROJECT_DIR/popularity\n \n (Here `$PROJECT_DIR` is your project root directory.)\n \n#) Add popularity to `INSTALLED_APPS` in settings.py::\n\n\tINSTALLED_APPS = (\n\t ...\n\t 'popularity',\n\t ...\n\t)\n \n Optionally, use the variable `POPULARITY_CHARAGE` to the characteristic \n number of seconds after which an object grows 'twice as old'.\n \n There is also a configuration variable `POPULARITY_LISTSIZE` to set the\n default number of 'popular' items returned.\n \n#) Create required data structure::\n \n\tcd $PROJECT_DIR\n\t./manage.py syncdb\n \n#) Run the tests to see if it all works::\n \n\t./manage.py test\n \n If this fails, please contact me!\n If it doesn't: that's a good sign, chap! Go on to the next step.\n \n#) Register the model you want to track by placing the following code \n somewhere, preferably in `models.py`::\n \n\timport popularity\n\tpopularity.register()\n \n This will assure that a ViewTracker gets created for each object that is \n created and that it is deleted when that particular object is deleted as\n well. Also, this keeps track of add dates of objects.\n \n#) Next, make sure that for every method where you view an object you add the \n following code (replace by whatever you are viewing)::\n \n\tfrom popularity.models import ViewTracker\n\t...\n\tViewTracker.add_view_for()\n \n If you want to make sure that your application also works when\n django_popularity is not present, use the following code for importing::\n \n\timport logging\n\t\n\tfrom django.conf import settings\n\t\n\tif 'popularity' in settings.INSTALLED_APPS:\n\t logging.debug('Django_popularity found and will be used.')\n\t from popularity.models import ViewTracker\n\t add_view_for = ViewTracker.add_view_for\n\t\n\telse:\n\t logging.warn('Django_popularity not found, creating a bogus function.')\n\t # If popularity does not exist, create a bogus function.\n\t def add_view_for(*args, **kwargs):\n\t pass\n\t `demo/testapp/views.py`.\n \n **Alternatively**, you can also use signals to register the viewing of \n instances::\n \n\tfrom popularity.signals import view\n\t...\n\tview.send()\n \n As there are multiple methods to do this, just pick one. They should be \n equally good. If you have a preference for either one, please let me know\n because two options to do exactly the same sounds like overhead to me.\n \n **Lastly**, django-popularity has recently been extended with a beautiful AJAX way\n to register views for an object. This is useful for interactive scripted\n ways of viewing objects, for instance for registering views of movies. As of now it\n is still very much a work in progress but it seems to work quite well.\n (But are, however, much welcomed by the author.)\n \n To use this, add the following to your `urls.py`::\n \n\turlpatterns += patterns('',\n\t ...\n\t (r'^viewtracker/', include('popularity.urls')),\n\t ...\n\t)\n \n You can now register views by requesting the url `/viewtracker///`\n which is facilitated by two lines of JavaScript (using something like jQuery)::\n \n\tfunction add_view_for(content_type_id, object_id) {\n\t $.get('/viewtracker/' + content_type_id + '/' + object_id+'/')\n\t}\n \n To facilitate the useage of this there is a template tag::\n \n\t{% load popularity_tags %}\n\t...\n\t\n\t\n This will render as::\n \n\t,)\" />\n \n **WARNING**: If you use the latter method, please be aware that it becomes tremendously easier for anyone on\n the web to register 'fake' views for objects. Hence, this might be considered a security\n risk.\n \n#) Now if you want to use the information you've just gathered, the easiest\n way is to use the included RequestContextProcessors. To do this, include\n the following in your `settings.py`::\n \n\tTEMPLATE_CONTEXT_PROCESSORS = (\n\t ...\n\t 'popularity.context_processors.most_popular',\n\t 'popularity.context_processors.most_viewed',\n\t 'popularity.context_processors.recently_viewed',\n\t 'popularity.context_processors.recently_added',\n\t)\n \n Here, the first processors are Django's default. The latter respectively\n add `most_popular`, `most_viewed`, `recently_viewed` and `recently_added`\n to the RequestContext.\n \n (If you don't know what a RequestContext is, do not pity yourself.\n Visit http://docs.djangoproject.com/en/dev/ref/templates/api/#id1.)\n\n A second way is to use template tags. As with all sets of custom tags you must \n first call {% load popularity_tags %} in your template. There 6 template tags you \n can use which are described below.\n \n :Tag: views_for_object\n :Usage: `{% views_for_object widget as views %}`\n :Description: Retrieves the number of views for and stores them in a context variable.\n \n :Tag: views_for_objects\n :Usage: `{% views_for_objects widget_list as view_count %}`\n :Description: Retrieves the number of views for each object and stores them in an attribute.\n After using this tag the views for each widget in the widget_list can be accessed \n through widget_list.view_count.\n\n :Tag: most_popular_for_model\n :Usage: `{% most_popular_for_model main.model_name as popular_models %}` or\n `{% most_popular_for_model main.model_name as popular_models limit 20 %}`\n :Description: Retrieves the ViewTrackers for the most popular instances of the given model.\n If the limit is not given it will use settings.POPULARITY_LISTSIZE. The model should be\n given by the app name followed by the model name such as comments.Comment or auth.User.\n\n :Tag: most_viewed_for_model\n :Usage: `{% most_viewed_for_model main.model_name as viewed_models %}` or\n `{% most_viewed_for_model main.model_name as viewed_models limit 20 %}`\n :Description: Retrieves the ViewTrackers for the most viewed instances of the given model.\n If the limit is not given it will use settings.POPULARITY_LISTSIZE. The model should be\n given by the app name followed by the model name such as comments.Comment or auth.User.\n\n :Tag: recently_viewed_for_model\n :Usage: `{% recently_viewed_for_model main.model_name as recent_models %}` or\n `{% recently_viewed_for_model main.model_name as recent_models limit 20 %}`\n :Description: Retrieves the ViewTrackers for the most recently viewed instances of the given model.\n If the limit is not given it will use settings.POPULARITY_LISTSIZE. The model should be\n given by the app name followed by the model name such as comments.Comment or auth.User.\n \n :Tag: recently_added_for_model\n :Usage: `{% recently_added_for_model main.model_name as recent_models %}` or\n `{% recently_added_for_model main.model_name as recent_models limit 20 %}`\n :Description: Retrieves the ViewTrackers for the most recently added instances of the given model.\n If the limit is not given it will use settings.POPULARITY_LISTSIZE. The model should be\n given by the app name followed by the model name such as comments.Comment or auth.User.\n \n#) Now you're done. Go have beer. Or a whiskey. Or coffee. Suit yourself.\n If you're still not done learning, try reading through the many methods\n described in `popularity/models.py` as they are to be documented later.\n\nCredits\n=======\nDjango-popularity was initially developed by Mathijs de Bruin while\nworking for Visualspace .\n\nMajor and minor contributions to this project were made by:\n\n- Daniel Nordberg \n- Mark Lavin \n\nLicense\n=======\nThis application is released \nunder the GNU Affero General Public License version 3.", "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/dokterbob/django-popularity", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-popularity", "package_url": "https://pypi.org/project/django-popularity/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-popularity/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/dokterbob/django-popularity" }, "release_url": "https://pypi.org/project/django-popularity/0.2/", "requires_dist": null, "requires_python": null, "summary": "A generic view- and popularity tracking pluggable for Django.", "version": "0.2" }, "last_serial": 790314, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "8e63edbeb5cd601252bbf52372fbd23d", "sha256": "f512c5033a3e3336a457caf64beb4003da9d4898d8a5456652afc4d507e24218" }, "downloads": -1, "filename": "django-popularity-0.1.tar.gz", "has_sig": false, "md5_digest": "8e63edbeb5cd601252bbf52372fbd23d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21786, "upload_time": "2009-12-11T14:09:20", "url": "https://files.pythonhosted.org/packages/fb/39/89e97a63218b86edc31038df0a09a27d8013eee6c54a7394eda6a72f88e2/django-popularity-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "11e74cba77f07d3a8d019506dec00726", "sha256": "4ccb0334012e766b2b58ca053f2e895534468f26264dd11a5ed185a003dff27e" }, "downloads": -1, "filename": "django-popularity-0.1.1.tar.gz", "has_sig": false, "md5_digest": "11e74cba77f07d3a8d019506dec00726", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21797, "upload_time": "2009-12-11T14:17:54", "url": "https://files.pythonhosted.org/packages/ef/76/eeef4a6b8b167365a0ea1548d4c43eea4bd0fa3e95932e60219960c32230/django-popularity-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "1d9f1621076f581db0b5bf8df90f4ad1", "sha256": "96f30602c37f890089c13f73854b082bd33010ad6678fc271360fd6b7ae9c68a" }, "downloads": -1, "filename": "django-popularity-0.1.2.tar.gz", "has_sig": false, "md5_digest": "1d9f1621076f581db0b5bf8df90f4ad1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24728, "upload_time": "2009-12-11T14:24:15", "url": "https://files.pythonhosted.org/packages/8c/b4/70852abd27bd69041bce9ff47441832bbb10476817257925caf10e0eadc7/django-popularity-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "409f3ecdd7450b99072c89ed84d38733", "sha256": "d711cbb47edebbf0e246d1d22982de254737612b149c93877a81227b60690a28" }, "downloads": -1, "filename": "django-popularity-0.1.3.tar.gz", "has_sig": false, "md5_digest": "409f3ecdd7450b99072c89ed84d38733", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24747, "upload_time": "2009-12-11T15:02:58", "url": "https://files.pythonhosted.org/packages/66/dd/3344ae750b874b51f0f3c308e3a82b18ade97377d130d191bed0754cf15a/django-popularity-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "798052caed3b8f635dc58b747067ac8e", "sha256": "2d2599b114ed6d8e2415fce21f5b018a2ca2aa321188807a3935207a5888f8f2" }, "downloads": -1, "filename": "django-popularity-0.1.4.tar.gz", "has_sig": false, "md5_digest": "798052caed3b8f635dc58b747067ac8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24742, "upload_time": "2009-12-11T15:03:42", "url": "https://files.pythonhosted.org/packages/cd/70/64b4336555e17f1807abee00f91f7ce92a3bd248818270b5ad942692bbcd/django-popularity-0.1.4.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "db09cd79f11f2c5403a584dff98b1290", "sha256": "e1d0acad0fc2c987afbf8e3edd6e75ddbb463e72db2c7d96da0d1134471de1c7" }, "downloads": -1, "filename": "django-popularity-0.2.tar.gz", "has_sig": false, "md5_digest": "db09cd79f11f2c5403a584dff98b1290", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25067, "upload_time": "2010-02-02T22:32:45", "url": "https://files.pythonhosted.org/packages/ae/0d/33111d1dbaaa293f6fb14bd09d29f4738582a542a57222fef5484983d131/django-popularity-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "db09cd79f11f2c5403a584dff98b1290", "sha256": "e1d0acad0fc2c987afbf8e3edd6e75ddbb463e72db2c7d96da0d1134471de1c7" }, "downloads": -1, "filename": "django-popularity-0.2.tar.gz", "has_sig": false, "md5_digest": "db09cd79f11f2c5403a584dff98b1290", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 25067, "upload_time": "2010-02-02T22:32:45", "url": "https://files.pythonhosted.org/packages/ae/0d/33111d1dbaaa293f6fb14bd09d29f4738582a542a57222fef5484983d131/django-popularity-0.2.tar.gz" } ] }