{ "info": { "author": "Jannis Leidel", "author_email": "jannis@leidel.info", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Utilities" ], "description": "=============================================\nThe Django admin interface for mobile devices\n=============================================\n\n.. contents::\n :backlinks: none\n\nThis is an alternative admin interface for Django for use with mobile devices\nsuch as the iPhone/iPod touch or Blackberry. Some would call it a theme or a\nskin, but actually it's more than that.\n\nIt resembles almost all features of the regular Django admin interface and\nbrings everything you need to add support for arbitrary devices.\n\nI hope you like it.\n\nDownload & Installation\n=======================\n\nGet the source from the application site at::\n\n http://code.google.com/p/django-mobileadmin/\n\nTo install the *mobileadmin*, follow these steps:\n\n1. Follow the instructions in the INSTALL.txt file\n2. Add ``'mobileadmin'`` to the INSTALLED_APPS_ setting of your Django site.\n That might look like this::\n \n INSTALLED_APPS = (\n # ...\n 'mobileadmin',\n )\n \n3. Make sure you've installed_ the admin contrib app.\n4. Add ``'mobileadmin.context_processors.user_agent'`` to your \n TEMPLATE_CONTEXT_PROCESSORS_ setting. It should look like this::\n \n TEMPLATE_CONTEXT_PROCESSORS = (\n 'django.core.context_processors.auth',\n 'django.core.context_processors.debug',\n 'django.core.context_processors.i18n',\n 'django.core.context_processors.media',\n 'django.core.context_processors.request',\n 'mobileadmin.context_processors.user_agent',\n )\n\nUsage\n=====\n\nSince *mobileadmin* follows the ideas of Django's admin interface you can\neasily reuse your existing admin setup:\n\nYou use the default or custom ModelAdmin classes for each model you wanted\nto be editable in the admin interface and hooked up Django's default\nAdminSite instance with your URLconf.\n\nIf that's the case you are able to re-use those ModelAdmin (sub-)classes\nby using *mobileadmin*'s separate admin site instance and its autoregister()\nfunction.\n\n1. In your root URLconf -- just **below** the line where Django's\n admin.autodiscover() gets called -- import ``mobileadmin`` and call the\n function ``mobileadmin.autoregister()``::\n\n # urls.py\n from django.conf.urls.defaults import *\n from django.contrib import admin\n\n admin.autodiscover()\n\n import mobileadmin\n mobileadmin.autoregister()\n\n urlpatterns = patterns('',\n ('^admin/(.*)', admin.site.root),\n )\n \n This registers your existing admin configuration with *mobileadmin*.\n\n2. Extend the urlpatterns to hook the default ``MobileAdminSite`` instance`\n with your favorite URL, e.g. ``/ma/``. Add::\n\n urlpatterns += patterns('',\n (r'^ma/(.*)', mobileadmin.sites.site.root),\n )\n \n *mobileadmin* is now replicating all of the regular admin features and\n uses templates adapted to the mobile device you are using.\n\n3. Set the ``handler404`` and ``handler500`` variables in your URLConf to the\n views that are provided by *mobileadmin*::\n\n handler404 = 'mobileadmin.views.page_not_found'\n handler500 = 'mobileadmin.views.server_error'\n \n That is needed to load the ``404.html`` and ``500.html`` templates\n according to the user agent of the browser on your mobile device. It\n has an automatic fallback to `Django's default error handlers`_.\n\n.. _INSTALLED_APPS: http://docs.djangoproject.com/en/dev/ref/settings/#installed-apps\n.. _ADMIN_MEDIA_PREFIX: http://docs.djangoproject.com/en/dev/ref/settings/#admin-media-prefix\n.. _TEMPLATE_CONTEXT_PROCESSORS: http://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors\n.. _installed: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#overview\n.. _Django's default error handlers: http://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views\n\nExtending ``mobileadmin``\n=========================\n\n*mobileadmin* comes with a default set of templates and patterns to\nrecognize different devices and platforms:\n\n- Mobile Safari (iPhone/iPod touch)\n\nBut it's made for being extended.\n\nSince the template loading depends on the user agent of the requesting client,\n*mobileadmin* tells Django to look for three templates, when trying to render\none of the default admin views:\n\n1. ``mobileadmin/USER_AGENT_NAME/VIEW_TEMPLATE.html``\n2. ``mobileadmin/VIEW_TEMPLATE.html``\n3. ``admin/index.html``\n\n..where:\n \n- ``USER_AGENT`` is the short name of the user agent\n- ``VIEW_TEMPLATE`` is the name of the rendered template\n\nIf you would try to access the login view with the iPhone for example, the\nfollowing three templates would be tried to load:\n\n1. ``mobileadmin/mobile_safari/login.html``\n2. ``mobileadmin/login.html``\n3. ``admin/index.html``\n\n..where ``mobile_safari`` is the name of one of the default device patterns\nand ``login.html`` the name of the to needed template.\n\nCreating a custom ``mobileadmin`` setup\n---------------------------------------\n\nYou can add support for more user agents by adding ``MOBILEADMIN_USER_AGENTS``\nto your settings.py file -- consisting of a short name and a regualar\nexpression, matching that user agent string::\n\n MOBILEADMIN_USER_AGENTS = {\n 'my_user_agent': r'.*MyUserAgent.*',\n }\n\nWith that it would automatically check if the regular expression matches with\nthe user agent of the current request and -- if yes -- try to load the\ntemplates ``mobileadmin/my_user_agent/login.html``, when accessing the the\nlogin page -- falling back to ``my_user_agent/login.html`` and later to\n``admin/login.html``, if not found.\n\nHave a look at ``TEMPLATE_MAPPING`` in ``mobileadmin/conf/settings.py``\nif you want to know the default regular expressions.\n\n*mobileadmin* comes with a ``MobileAdminSite`` and a ``MobileModelAdmin``\nclass that uses the default ``TEMPLATE_MAPPING`` and ``USER_AGENTS``\nsettings out of the box::\n\n from mobileadmin import sites\n \n class MyMobileAdminSite(sites.MobileAdminSite):\n # define here whatever function you want\n pass\n\nBut if you want to use the ability of *mobileadmin* to change the template\ndepending on the user agent, you need to modify a bit of your admin classes.\n\nLuckily *mobileadmin* comes with a decorator to be used on ``AdminSite`` or\n``ModelAdmin`` methods that changes the template of that method according to\nthe current user agent by using a template mapping, which can be found in\n``mobileadmin/conf/settings.py`` in the ``TEMPLATE_MAPPING`` variable.\n\nThose mappings are used by the decorator ``mobile_templates`` that applies\nthem on the corresponding methods of your own ``AdminSite`` or\n``ModelAdmin``, e.g.::\n\n from django.contrib.admin import sites\n from mobileadmin.decorators import mobile_templates\n \n class MyAdminSite(sites.AdminSite):\n \n def index(self, request, extra_context=None):\n\n # self.index_template is already automatically set here\n # do something cool here\n \n return super(MyAdminSite, self).index(request, extra_context)\n index = mobile_templates(index)\n\nFurthermore the default mappings can be extended in your site settings.py::\n\n MOBILEADMIN_TEMPLATE_MAPPING = {\n 'index': ('index_template', 'index.html'),\n }\n\n..where:\n\n- ``index`` is the name of the function, whose class attribute and\n- ``index_template`` (an attribute of the method's class) would be set to the\n the file ``index.html``.\n\nUsing custom mobile admin interfaces\n------------------------------------\n\nIn case you created your own mobile admin interface, you can use\n*mobileadmin*'s subclasses of Django's `ModelAdmin`_, `InlineModelAdmin`_\nand `AdminSite`_ classes, that include the neccesary bits to make it work.\n\nJust use it as you would use the base classes, e.g.::\n\n from mobileadmin import options\n from myproject.myapp.models import Author\n\n class MobileAuthorAdmin(options.MobileModelAdmin):\n pass\n mobileadmin.sites.site.register(Author, MobileAuthorAdmin)\n\nThen import ``mobileadmin`` in your URLconf to instantiate a\n``MobileAdminSite`` object, use Django's ``autodiscover()`` to load\n``INSTALLED_APPS`` admin.py modules and add an URL for the *mobileadmin* to\nthe URLConf::\n\n # urls.py\n from django.conf.urls.defaults import *\n from django.contrib import admin\n import mobileadmin\n\n admin.autodiscover()\n\n urlpatterns = patterns('',\n ('^admin/(.*)', admin.site.root),\n (r'^ma/(.*)', mobileadmin.sites.site.root),\n )\n\n.. _InlineModelAdmin: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodeladmin-objects\n.. _AdminSite: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#adminsite-objects\n.. _ModelAdmin: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#modeladmin-objects\n\nMedia path\n==========\n\nPlease feel free to use some nice little helpers to find the path to\n*mobileadmin*'s media directory. If you are using Django (or any other Python\nsoftware) to serve static files (which you shouldn't in production) just use\nfor example::\n\n from mobileadmin.conf import settings\n\n mobileadmin_media_path = settings.MEDIA_PATH\n mobileadmin_media_prefix = settings.MEDIA_PREFIX\n\nYou now have the full (platform-independent) path to the media directory of\n*mobileadmin* in the variable ``mobileadmin_media_path`` and the default URL\nprefix (``'/mobileadmin_media/'``) for the *mobileadmin* media -- CSS, Javascript\nand images -- in ``mobileadmin_media_prefix``. Just like the\nADMIN_MEDIA_PREFIX_ but for the ``media`` directory of the *mobileadmin* app.\n\nYou can of course optionally override the default URL prefix by setting\na ``MOBILEADMIN_MEDIA_PREFIX`` in the settings.py file of your Django site.\nPlease use a trailing slash. This makes updating *mobileadmin* much easier for\nyou, since you now don't have to bother about different locations of the media\ndirectory. \n\nServing *mobileadmin*'s static media\n------------------------------------\n\nEven though using Django's ability to serve static files is strongly **NOT\nRECOMMENDED** for live production servers, it might be helpful to bring up\n*mobileadmin* for a test drive or an intranet website. Just add the following\ncode to the URLConf (``urls.py``) of your Django site::\n\n from mobileadmin.conf import settings\n \n urlpatterns += patterns('django.views.static',\n (settings.MEDIA_REGEX, 'serve', {'document_root': settings.MEDIA_PATH}),\n )\n\nSee how *mobileadmin*'s own settings module is loaded at the top of the snippet\nthat enables you to obtain a ready-made regex for the static files\n(``MEDIA_REGEX``) and the platform-independent filesystem path to the media\nfiles (``MEDIA_PATH``).\n\nSupport\n=======\n\nPlease leave your `questions and problems`_ on the `designated Google Code site`_.\n\n.. _designated Google Code site: http://code.google.com/p/django-mobileadmin/\n.. _questions and problems: http://code.google.com/p/django-mobileadmin/issues/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://code.google.com/p/django-mobileadmin/", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-mobileadmin", "package_url": "https://pypi.org/project/django-mobileadmin/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-mobileadmin/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://code.google.com/p/django-mobileadmin/" }, "release_url": "https://pypi.org/project/django-mobileadmin/0.5.2/", "requires_dist": null, "requires_python": null, "summary": "The Django admin interface for mobile devices.", "version": "0.5.2" }, "last_serial": 638524, "releases": { "0.5.1": [ { "comment_text": "", "digests": { "md5": "da4314f6ba73c48bc4ac4a2d84b9c204", "sha256": "0b34c26abe39af3974bc15d2722b1a844eae94b8c45b40dfb071e3f76ef8af75" }, "downloads": -1, "filename": "django-mobileadmin-0.5.1.tar.gz", "has_sig": false, "md5_digest": "da4314f6ba73c48bc4ac4a2d84b9c204", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30017, "upload_time": "2008-09-07T22:27:14", "url": "https://files.pythonhosted.org/packages/3e/89/4f5e60d8dd6d08b83d16343380cc32b8f85c754da2bf28e539aff995a842/django-mobileadmin-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "c596330f71c530bceeadf840786a27a5", "sha256": "2e16f4096dda14a9934cc49780a313ca0490264ca4939db03a4d4f7531656e60" }, "downloads": -1, "filename": "django-mobileadmin-0.5.2.tar.gz", "has_sig": false, "md5_digest": "c596330f71c530bceeadf840786a27a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30929, "upload_time": "2008-09-08T00:12:35", "url": "https://files.pythonhosted.org/packages/82/46/af67de2c2f07d313f5afaf3e8f08398dcd2d2ac9a342b777f46c7e5b7dd5/django-mobileadmin-0.5.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "c596330f71c530bceeadf840786a27a5", "sha256": "2e16f4096dda14a9934cc49780a313ca0490264ca4939db03a4d4f7531656e60" }, "downloads": -1, "filename": "django-mobileadmin-0.5.2.tar.gz", "has_sig": false, "md5_digest": "c596330f71c530bceeadf840786a27a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 30929, "upload_time": "2008-09-08T00:12:35", "url": "https://files.pythonhosted.org/packages/82/46/af67de2c2f07d313f5afaf3e8f08398dcd2d2ac9a342b777f46c7e5b7dd5/django-mobileadmin-0.5.2.tar.gz" } ] }