Code


Version 19 (modified by robhudson, 4 years ago) (diff)

--

Original Admin UI proposal: http://groups.google.com/group/django-developers/browse_thread/thread/1edf77c9c8b1101d/4ecda5e4c982c7e1

Updated branch on Github: http://github.com/dgouldin/django/tree/soc2009/admin-ui

In general:

  • Commits should be broken up into a series of patches -- 1 for each incremental improvement or feature (e.g. autocomplete, selector inlines, etc).
  • All the JS for the admin should be minified, but we need to ship maximized versions too, for ease of editing, and then have a build process do the minification.
    • Note: This may be better saved for last.
  • Updating the old Javascript to use jQuery is an end goal, but not one required to get admin-ui merged.
  • Document where js libs come from for ease of checking on new versions and finding full source.

Suggested individual patches.

ForeignKey and ManyToMany autocomplete is being worked on by Rob Hudson on the Github tree: http://github.com/robhudson/django/tree/autocomplete

Current issues:

  • ForeignKey autocomplete:
    • No docs
    • No tests
    • If FK is the first field in the admin, the JS focuses on the ID box rather than the text search box.
    • Similarly, if you click the text label the focus is on the ID rather than the text search box.
    • Changing the ID does not pull the name into the text search box.
    • Clicking the magnifier opens a new window to choose an object, selecting an object only updates the ID box, no the text search box.
    • Should the ID box be hidden from the user? I can see arguments either way.

Summary of commits on the soc2009/admin-ui branch:

  1. jQuery itself.
  2. Stacked Inline add new inline dynamically.
  3. Selector Inlines (based on Wilson Miner's mockup http://media.wilsonminer.com/images/django/related-objects-stacked.gif)
  4. Tabular Inline ordering. Given an order_field on the TabularInline admin object.
  5. models.fields.OrderField added, subclass of IntegerField with default=0.
  6. django.forms.formsets grew a empty_form method with prefix set to __prefix__ which Javascript replaces with a value when dynamically adding new inlines.
  7. ForeignKeySearchInput widget, which does autocompletion on Foreign key fields.
  8. ManyToManySearchInput, autocompletion for m2m fields.

Possibly related tickets: