djangosnippets.org: Latest snippets tagged with 'mobile'https://djangosnippets.org/tags/mobile/2010-10-07T13:32:54.674240-05:00Simple Mobile Support
2010-10-07T13:32:54.674240-05:00bahoohttps://djangosnippets.org/snippets/2228/<p>For those interested in making a mobile site geared toward the higher end devices, and wanting a little leverage over device-specific quirks.</p>
<p>These are the big players in the U.S. market, but of course, add your own User-Agents to match your audience's popular browsers.</p>
<p>Usage:</p>
<pre><code> <html class="{{ device.classes }}">
</code></pre>
<p>You …</p>
Freely redistributableMobile Device Middleware
2010-05-22T06:17:22.041143-05:00stephen_mcdhttps://djangosnippets.org/snippets/2033/<p>Middleware class that checks the user agent against a known list of strings found in mobile devices, and if matched it then tries to determine the name of the template being rendered based on the convention of having every view use a keyword arg called "template". It then adds "mobile" …</p>
Freely redistributableMobile browser detection middleware
2010-04-29T09:31:43.383324-05:00pavlhttps://djangosnippets.org/snippets/2001/<p>This middleware adds a "is_mobile" (boolean) to the request object if the user's browser is a mobile browser (iPhone, Nokia, etc).
</p>
<p><strong>Example of use inside a view:</strong> <code>request.is_mobile</code>
</p>
<p><strong>Example of use inside a template:</strong> <em>You must activate the template processor "django.core.context_processors.request" in your settings. (see TEMPLATE_CONTEXT_PROCESSORS at djangoproject.com)</em> <code>{{ request.is_mobile …</code></p>
Freely redistributableA templatetag to insert the output of another view (or local URL)
2009-06-17T04:20:32.206375-05:00jamesgpearcehttps://djangosnippets.org/snippets/1568/<p>Inserts the output of a view, using fully qualified view name (and then some
args), a or local Django URL.</p>
<pre><code>{% view view_or_url arg[ arg2] k=v [k2=v2...] %}
</code></pre>
<p>This might be helpful if you are trying to do 'on-server' AJAX of page
panels. Most browsers can call back to the …</p>
Freely redistributableMobilize your Django site
2009-04-13T12:56:07.192854-05:00stevena0https://djangosnippets.org/snippets/1437/<p><strong>Mobilize your Django site</strong></p>
<p>This is the code for a Django middleware class to allow you to easily mobilize your Django site. It makes use of <a href="http://wapple.net">Wapple.net</a>'s Web services to provide device profiling and markup generation.</p>
<p>Using this middleware plugin, you can deliver your site to both mobile and …</p>
Freely redistributableAdmob Ad Insertion Snippet
2008-07-15T11:08:55.449509-05:00johnboxallhttps://djangosnippets.org/snippets/883/<p><strong>Update</strong>:</p>
<p><a href="http://github.com/johnboxall/django_admob/tree/master">Django AdMob</a> pluggable app on github.</p>
<p>Given a Django <code>request</code> object and dict of admob parameters returns a Admob ad.</p>
<p>If no ad can be retrieved displays a one pixel Admob tracker image.</p>
<p>For the future:</p>
<ul>
<li>
<p>Make a template tag for this?</p>
</li>
<li>
<p>Filter out other unneeded META parameters …</p></li></ul>
Freely redistributable