Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better encapsulation #5

Open
andybak opened this issue Jan 7, 2013 · 2 comments
Open

Better encapsulation #5

andybak opened this issue Jan 7, 2013 · 2 comments

Comments

@andybak
Copy link

andybak commented Jan 7, 2013

This is going to be a rather vague issue report but I'll try and explain myself as best I can.

I ran the example project and loved the result.

However - when I looked at the code - too much of the work seemed to be happening in the template for the example app and not enough in the app itself.

I currently lack any concrete suggestions for fixing this but my hunch is that with some clever template inheritance, mixins to use with ModelAdmin subclasses or maybe some templatetags to use in admin templates, then implementing this could be a lot simpler and cleaner.

@diox
Copy link
Contributor

diox commented Jan 7, 2013

I think we all agree here :)

We need specific extensions points in templates and we couldn't find a clean way to do this without redefining our own, sadly. It might be a little better in 1.4 and 1.5 (and we could drop 1.3 support if needed), I haven't checked. Feel free to submit more concrete ideas, a proof-of-concept, or even a full pull request if you have some time to work on it, we'll gladly accept any help :-)

@andybak
Copy link
Author

andybak commented Jan 7, 2013

Thanks for the reply.

I've always regarded copy+pasting whole admin templates to be something to use only as a last resort (and by 'last resort' I mean only after I've tried chewing off my own leg!)

If there are no {% block %} tags that could possibly allow me to override a smaller part of the template I've usually resorted to manipulating the DOM with jQuery to get the result I need. It's actually not as bad as it sounds. It is brittle but is easy to fix up if the underlying HTML changes.

I do understand if you have aesthetic objections to this approach but it's worked well for some of my admin customizations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants