Django

Code

Ticket #535 (closed: fixed)

Opened 3 years ago

Last modified 2 years ago

Refactor admin code to clean it up

Reported by: robert@wittams.com Assigned to: rjwittams
Milestone: Component: django.contrib.admin
Version: Keywords:
Cc: jforcier@strozllc.com Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Following the mail thread http://groups.google.com/group/django-developers/browse_thread/thread/0e0ee390664ba078/65e6dffff7699a22#65e6dffff7699a22

I have started to refactor the admin code to a) Make it easier to work on b) Make it clearer what the deficiencies in the meta system are for interfaces like the admin

I will attach patches here. The patches do include some additional changes, eg ones I have applied from other tickets.

Attachments

django-admin-refactor.patch (53.9 kB) - added by robert@wittams.com on 09/21/05 18:07:43.
1st cut of the change and add views refactored to templates
django-admin-refactor-2.patch (53.5 kB) - added by robert@wittams.com on 09/22/05 13:22:22.
updated patch
django-admin-refactor-3.patch (57.9 kB) - added by robert@wittams.com on 09/22/05 21:50:49.
patch that refactors data flattening
django-admin-refactor-4.patch (64.5 kB) - added by robert@wittams.com on 09/23/05 13:37:59.
Makes inline editing a piece of cake outside the admin
django-admin-refactor-5.patch (71.6 kB) - added by robert@wittams.com on 09/24/05 17:18:42.
Clean up templates a bit, allow overriding edit_inline behaviour with custom templates.
django-admin-refactor-6.patch (75.8 kB) - added by robert@wittams.com on 09/27/05 19:10:08.
Updated patch

Change History

09/21/05 18:07:43 changed by robert@wittams.com

  • attachment django-admin-refactor.patch added.

1st cut of the change and add views refactored to templates

09/21/05 18:10:36 changed by adrian

  • summary changed from Admin refactoring to Refactor admin code to clean it up.

09/21/05 18:18:28 changed by anonymous

The first cut patch includes the following changes:

* I have duplicated the add and change stages, so they can be compared with the old ones, rather than replacing them. Just add /new/ on to the end of a url to see the new pages. They should look very similar.

* The template concatenation part of these stages has been replaced by a combination of templates, template tags, and helper objects. As the helper objects evolve, it should expose where it would be useful to push methods or whole classes into the meta system.

* I am currently trying to preserve the output that is produced by the old views. Nevertheless, there are sure to be bits I have changed. One particular point is whitespace : templates preserve a lot of whitespace, which is duplicated (eg in for loops). This is maybe something to tackle in the template system at some point. I will eventually start to make modifications to the output ( which imo is a lot easier with the new scheme).

This is all at a very early stage, so take it as a given that the code is in a lot of flux.

09/21/05 18:25:33 changed by anonymous

  • owner changed from robert@wittams.com to anonymous.
  • status changed from new to assigned.

09/21/05 18:26:13 changed by robert@wittams.com

  • owner changed from anonymous to robert@wittams.com.
  • status changed from assigned to new.

09/21/05 18:26:35 changed by robert@wittams.com

  • owner changed from robert@wittams.com to anonymous.
  • status changed from new to assigned.

09/21/05 18:28:10 changed by robert@wittams.com

I can't work out how to have this assigned to me. Boo hoo.

09/21/05 20:58:01 changed by anonymous

  • owner changed from anonymous to robert@wittams.com.
  • status changed from assigned to new.

09/21/05 20:58:47 changed by jacob

  • owner changed from robert@wittams.com to jacob.
  • status changed from new to assigned.

09/21/05 20:58:55 changed by jacob

  • owner changed from jacob to robert@wittams.com.
  • status changed from assigned to new.

09/21/05 20:59:37 changed by jacob

Heh -- neither can I :)

Go ahead and leave this as "new"; we'll know it's assigned to you.

09/22/05 13:22:22 changed by robert@wittams.com

  • attachment django-admin-refactor-2.patch added.

updated patch

09/22/05 21:50:49 changed by robert@wittams.com

  • attachment django-admin-refactor-3.patch added.

patch that refactors data flattening

09/22/05 21:59:54 changed by robert@wittams.com

I am having to call the patch different names, and thereby take up space, as trac gives an error when I upload with the same name.

This version of the patch (3), among other things, refactors the data flattening. I just need to a few more things to make it easy to do edit_inline type stuff from any random view. ( Sort out form field wrapper, and add a few new methods to the manipulators.)

Again, sure to be bugs in here - I know there is something wrong with 0 value integer fields in edit_inline for example. Also, I have not tested every option. One thing that I plan to make is an example model that tries out as many options as possible, so it is easy to spot regressions.

09/23/05 13:37:59 changed by robert@wittams.com

  • attachment django-admin-refactor-4.patch added.

Makes inline editing a piece of cake outside the admin

09/23/05 13:41:20 changed by robert@wittams.com

The latest patch makes inline editing work with no hacking about in view functions. Will post to django-devel about this.

09/24/05 17:18:42 changed by robert@wittams.com

  • attachment django-admin-refactor-5.patch added.

Clean up templates a bit, allow overriding edit_inline behaviour with custom templates.

09/24/05 17:51:02 changed by anonymous

So this latest patch lets you do stuff like

class Set(meta.Model):

workout = meta.ForeignKey?(Workout, edit_inline='edit_inline_horizontal')

This means that the template 'edit_inline_horizontal' is loaded to handle the inline stuff in the admin.

Also fixes rezrovs issues with selects. But I'm not yet convinced in the right way... And makes the many-to-many funky js stuff work again.

09/24/05 17:52:00 changed by robert@wittams.com

this thing needs cookies or something. Or give out accounts.

09/27/05 19:10:08 changed by robert@wittams.com

  • attachment django-admin-refactor-6.patch added.

Updated patch

09/27/05 19:13:15 changed by robert@wittams.com

Fixes select fields, adding with inline related objects, sorting descending on a 'select' keyword arg. The last one is a bug fix which would work on its own.

09/30/05 08:18:29 changed by rjwittams

  • owner changed from robert@wittams.com to anonymous.
  • status changed from new to assigned.

This patch is now on the new-admin branch.

09/30/05 08:18:51 changed by anonymous

  • owner changed from anonymous to rjwittams.
  • status changed from assigned to new.

10/03/05 11:03:29 changed by pylorca

when I edit the saved data (ChangeManipulator?), it only shows the values for the parent table, and empty values for the child tables, but the data exists

10/05/05 15:41:49 changed by anonymous

  • cc set to jforcier@strozllc.com.

11/25/05 15:52:10 changed by adrian

  • status changed from new to closed.
  • resolution set to fixed.

Fixed in [1434].


Add/Change #535 (Refactor admin code to clean it up)




Change Properties
Action