#535 closed task (fixed)
Refactor admin code to clean it up
Reported by: | Owned by: | rjwittams | |
---|---|---|---|
Component: | contrib.admin | Version: | |
Severity: | normal | Keywords: | |
Cc: | jforcier@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
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 (6)
Change History (26)
by , 19 years ago
Attachment: | django-admin-refactor.patch added |
---|
comment:1 by , 19 years ago
Summary: | Admin refactoring → Refactor admin code to clean it up |
---|
comment:2 by , 19 years ago
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.
comment:3 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:5 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:7 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:8 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:9 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:10 by , 19 years ago
Heh -- neither can I :)
Go ahead and leave this as "new"; we'll know it's assigned to you.
by , 19 years ago
Attachment: | django-admin-refactor-3.patch added |
---|
patch that refactors data flattening
comment:11 by , 19 years ago
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.
by , 19 years ago
Attachment: | django-admin-refactor-4.patch added |
---|
Makes inline editing a piece of cake outside the admin
comment:12 by , 19 years ago
The latest patch makes inline editing work with no hacking about in view functions.
Will post to django-devel about this.
by , 19 years ago
Attachment: | django-admin-refactor-5.patch added |
---|
Clean up templates a bit, allow overriding edit_inline behaviour with custom templates.
comment:13 by , 19 years ago
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.
comment:15 by , 19 years ago
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.
comment:16 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
This patch is now on the new-admin branch.
comment:17 by , 19 years ago
Owner: | changed from | to
---|---|
Status: | assigned → new |
comment:18 by , 19 years ago
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
comment:19 by , 19 years ago
Cc: | added |
---|
1st cut of the change and add views refactored to templates