Skip to main content

Django application that allows yo yout generic relations have a nice admin widget

Project description

Generic Foreign Key


Generic Foreign Key is a Django application that allows your Generic relations have a nice widget in the admin

It is distrubuted under the terms of the GNU Lesser General Public License <>


<script src="/media/js/jquery-1.2.6.min.js"></script>


Install in your base_site.html of django admin

<script src-"/media/js/jquery-1.2.6.min.js"></script>

In your

Add a setting EXCLUDE_CONTENT_TYPES, with the content types to exclude. This step is not necesary, but advisable

EXCLUDE_CONTENT_TYPES = (('auth', 'group'), ('auth', 'messege'), ...)

You can filter too, with this setting

FILTER_CONTENT_TYPES = (('auth', 'group'), ('auth', 'messege'), ...)

If you want to a UI more friendly to select a the content


And in your change_list.html overwrite extrastyle block:

{% block extrastyle %}
  {{ block.super }}
  <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/changelists.css" />
  {% if cl.formset %}
      <link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />
      {% url admin:jsi18n as jsi18nurl %}
      <script type="text/javascript" src="{{ jsi18nurl|default:'../../jsi18n/' }}"></script>
  {% endif %}
  {{ media }}
  {% if not actions_on_top and not actions_on_bottom %}
      #changelist table thead th:first-child {width: inherit}
  {% endif %}
  {{ generic_fk_media }}
{% endblock %}

In your ModelAdmin

Extend yout ModelAdmin with GenericAdmin

class MyModelAdmin(GenericAdmin):


  • Spanish translations

Project details

Release history Release notifications

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-genericforeignkey-0.60.4.tar.gz (14.1 kB) Copy SHA256 hash SHA256 Source None Jun 23, 2011

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page