djangosnippets.org: Latest snippets tagged with 'apps'https://djangosnippets.org/tags/apps/2014-01-30T22:32:21-06:00App-specific delegation of template context processors2014-01-30T22:32:21-06:00oogleshttps://djangosnippets.org/snippets/3021/<p>Template context processor for delegating other context processors to individual apps.</p>
<p>Useful if all views within an app require common context variables that aren't required by other apps.</p>
Freely redistributableTest runner that installs &#39;tests&#39; packages as apps2013-09-24T15:23:38-05:00adrian_lchttps://djangosnippets.org/snippets/2994/<p>Ever tried to unit test custom fields or abstract models? If so, you probably used a solution like <a href="http://djangosnippets.org/snippets/2843/">this one</a>. It surely works, but it has some issues:</p>
<ol>
<li>Runs 'syncdb' several times.</li>
<li>It's not automatic. You must add the mixin or copy the code to each of the TestCases ...</li></ol>
Freely redistributableDjango Admin Index Custom App &amp; Model Ordering2011-11-27T14:46:48-06:00hschttps://djangosnippets.org/snippets/2613/<p>This templatetag was inspired by: <a href="http://djangosnippets.org/snippets/1939/">Admin App/Model Custom Ordering</a>.</p>
<p>I rewrote it from scratch because it wasn't working on my install.</p>
Freely redistributableUpdate All Apps to Latest Revision2008-07-01T18:04:48-05:00ericflohttps://djangosnippets.org/snippets/844/<p>A simple script that I have put in my Django applications directory to fetch the latest application code from git and svn.</p>
<p>For example, your directory structure might look like so:</p>
<pre><code>django-apps/
django-tagging/
django-pagination/
django-registration/
django-threadedcomments/
django-mptt/
update_apps.py
</code></pre>
<p>Where update_apps.py is the source of this snippet.</p>
<p>To run ...</p>
Freely redistributable3rd Party App Directories2008-06-30T14:48:10-05:00thalinhttps://djangosnippets.org/snippets/837/<p>How to make this work:</p>
<ul>
<li>Put the code into your settings.py (or even better, local_settings.py if you have one)</li>
<li>Put 3rd party apps you'd like to use into the directories specified in APP_DIRS.</li>
<li>Place 'appname', into INSTALLED_APPS.</li>
</ul>
<p>Just a little trick I use to keep from having ...</p>
Freely redistributableAutomagically import settings from installed applications2008-01-31T08:03:06-06:00jezdezhttps://djangosnippets.org/snippets/573/<p>Use this snippet at the end of your main settings.py file to automagically import the settings defined in each app of <code>INSTALLED_APPS</code> that begins with <code>APPS_BASE_NAME</code>.</p>
<p>Set <code>APPS_BASE_NAME</code> to the base name of your Django project (e.g. the parent directory) and put <code>settings.py</code> files in every app ...</p>
Freely redistributable