{ "info": { "author": "Alexander Ivanov", "author_email": "alexander.ivanov@redsolution.ru", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Natural Language :: English", "Natural Language :: Russian", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP :: Site Management", "Topic :: Internet :: WWW/HTTP :: Site Management :: Link Checking" ], "description": "================\ndjango-model-url\n================\n\nDjango-model-url helps you to show correctly links to all objects even if page`s url was changed.\n\nUsage case\n----------\n\nFor example, you have news page on your web site.\nYou add a lot of links to the news page from other pages.\nAt some time you had to change url for the news page. This action lead to the problem: all old links are broken now.\nOf course, you can add redirect from old address to new. This can application solve problem more elegantly.\n\nHow it works?\n-------------\n\nBefore you save content with hyperlink to your database ``django-model-url`` tries to replace it with something like this ``{@ myapp.models.MyModel id @}``.\nModule will search for controller (view) that presents specified url.\nIf controller will be found module calls it and looks for object in context that passed to template.\n\nWhen ever such \"macro-url\" will appear in response it will be replaced with actual url.\n\nInstallation:\n=============\n\nIn settings.py:\n---------------\n\n1. Add ``'modelurl'`` to your ``INSTALLED_APPS``.\n\n2. Add ``'modelurl.middleware.ModelUrlMiddleware'`` to the end of ``MIDDLEWARE_CLASSES``.\n\n3. Configure the list of available models to be used by django-model-url ::\n\n MODELURL_MODELS = [\n {\n 'model': 'myapp.models.MyModel',\n },\n ...\n ]\n\n4. Configure the list of views that return objects of specified models.\nYou must also specify the name of your context variable that represents your object ::\n\n MODELURL_VIEWS = [\n {\n 'view': 'myapp.views.get',\n 'context': 'object',\n },\n ]\n\nYou can disable view if you don`t want to work with it: ::\n\n MODELURL_VIEWS = [\n {\n 'view': 'django.contrib.admin.site.root',\n 'disable': True,\n },\n ]\n\n\nUsage:\n======\n\nIn your models:\n---------------\n\n1. You can check single url by hands before saving :: \n\n\tfrom modelurl.utils import ReplaceByView\n\t\n\tclass MyModel(models.Model):\n\t url = models.CharField(max_length=200)\n\t def save(self, *args, **kwargs):\n\t self.url = ReplaceByView().url(self.url)\n\t super(MyModel, self).save(*args, **kwargs)\n\n2. You can check html before saving ::\n\n\tfrom modelurl.utils import ReplaceByView\n\t\n\tclass MyModel(models.Model):\n\t html = models.TextField()\n\t def save(self, *args, **kwargs):\n\t self.html = ReplaceByView().html(self.html)\n\t super(MyModel, self).save(*args, **kwargs)\n\n3. You can use django-model-url together with `django-trusted-html`_ to make your html correct, pretty and safe.\n\nClassifiers:\n-------------\n\n`Utilities`_\n\n.. _`django-trusted-html`: http://pypi.python.org/pypi/redsolutioncms.django-trusted-html/\n.. _`Utilities`: http://www.redsolutioncms.org/classifiers/utilities", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "django model url", "license": "GPLv3", "maintainer": null, "maintainer_email": null, "name": "redsolutioncms.django-model-url", "package_url": "https://pypi.org/project/redsolutioncms.django-model-url/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/redsolutioncms.django-model-url/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/redsolutioncms.django-model-url/0.1.0/", "requires_dist": null, "requires_python": null, "summary": "Django model url keeps track your objects' urls and inserts dynamic links in content.\nDo not worry, that page has changed address. All the old links will continue to work.", "version": "0.1.0" }, "last_serial": 798706, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3c9f428ed7984ccf1c2b63a106bed134", "sha256": "c50ee9da966410c09124d1ef403c5f0f90fe08b52a1048a52c1c6f306e3286b9" }, "downloads": -1, "filename": "redsolutioncms.django-model-url-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3c9f428ed7984ccf1c2b63a106bed134", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31785, "upload_time": "2010-10-21T21:48:12", "url": "https://files.pythonhosted.org/packages/cb/90/6793cfa433cd346089e0cbb2138c90fec0031ef456b2ee13021ffe8d1afe/redsolutioncms.django-model-url-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3c9f428ed7984ccf1c2b63a106bed134", "sha256": "c50ee9da966410c09124d1ef403c5f0f90fe08b52a1048a52c1c6f306e3286b9" }, "downloads": -1, "filename": "redsolutioncms.django-model-url-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3c9f428ed7984ccf1c2b63a106bed134", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31785, "upload_time": "2010-10-21T21:48:12", "url": "https://files.pythonhosted.org/packages/cb/90/6793cfa433cd346089e0cbb2138c90fec0031ef456b2ee13021ffe8d1afe/redsolutioncms.django-model-url-0.1.0.tar.gz" } ] }