views:

89

answers:

1

I would like to override (create custom) widgets/foreign.html template for a ForeignKey field but can't find this in the source. Browsing the Django SVN respository I can find these files at revision: 7966, but they are removed after this revision;

http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/templates/widget?rev=7967

Where does the code to generate the form select field and 'add another/new' link html for a foreignkey field live?

How would I override this to create a custom form widget for a particular model field.

A: 

The newforms admin has changed things some what. If you haven't yet done so, I'd first recommend you to study what's new with newforms and especially newforms admin.

Here's the (wrapper for the) widget used for related fields. If you want to look at customizing the widgets, check out Jannis Leidel's blog posts.

Antti Rasinen