Customising an app: Keeping Django admin

336 views
Skip to first unread message

m...@maikhoepfel.de

unread,
Jan 24, 2013, 5:01:34 AM1/24/13
to django...@googlegroups.com
Hello all,

I've replaced the catalogue app with my own. I noticed I need a product class to create products, but found no way to do it in the dashboard. When I had a look in the Django admin, the catalogue models (to no surprise) were missing.
Am I right in assuming that the best practice to keep admin functionality is to create an admin.py and just import oscar.apps.catalogue.admin, as used to be done for template tags?

I actually already had updated the documentation to include that, but then realized the template tags  have been moved to oscar/templatetags, which makes a lot of sense. But now I'd rather double-check before rewriting the docs again :)

Regards,

Maik

David Winterbottom

unread,
Jan 24, 2013, 5:36:31 AM1/24/13
to django-oscar
On 24 January 2013 10:01, <m...@maikhoepfel.de> wrote:
Hello all,

I've replaced the catalogue app with my own. I noticed I need a product class to create products, but found no way to do it in the dashboard. When I had a look in the Django admin, the catalogue models (to no surprise) were missing.

Yes, this is something we need to address.  Normally, product classes are fixed and don't change very often.  I use a data migration to populate them for new projects.

I'll write some docs:
 
Am I right in assuming that the best practice to keep admin functionality is to create an admin.py and just import oscar.apps.catalogue.admin, as used to be done for template tags?

Yes, I think so.  I have toyed with the idea of putting all the admin in the main 'oscar' app which can't be overridden.  This would avoid this issue where the admin disappears.  
 

I actually already had updated the documentation to include that, but then realized the template tags  have been moved to oscar/templatetags, which makes a lot of sense. But now I'd rather double-check before rewriting the docs again :)

Regards,

Maik

--
https://github.com/tangentlabs/django-oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
Visit this group at http://groups.google.com/group/django-oscar?hl=en-US.
 
 



--
David Winterbottom
Head of Programming

Tangent Labs
84-86 Great Portland Street
London W1W 7NR
England, UK

m...@maikhoepfel.de

unread,
Jan 24, 2013, 7:25:50 AM1/24/13
to django...@googlegroups.com, david.win...@tangentlabs.co.uk

Yes, this is something we need to address.  Normally, product classes are fixed and don't change very often.  I use a data migration to populate them for new projects.
Thanks for clarifying.
 
Am I right in assuming that the best practice to keep admin functionality is to create an admin.py and just import oscar.apps.catalogue.admin, as used to be done for template tags?

Yes, I think so.  I have toyed with the idea of putting all the admin in the main 'oscar' app which can't be overridden.  This would avoid this issue where the admin disappears.  

That would be possible, considering that it would still be possible to replace the Admin classes by using admin.site.unregister, and then registering a custom version. I have to say I'm leaning towards not doing so though, because 'explicit is better than implicit', the fix is trivial and Oscar's apps would be a little less self-contained.

Sebastian Vetter

unread,
Jan 24, 2013, 7:55:26 AM1/24/13
to django...@googlegroups.com, m...@maikhoepfel.de, david.win...@tangentlabs.co.uk
Hi guys,
I agree with Maik. It think keeping the admin.py files in the app they
belong to makes it a bit more organised.

And a note about the customisation of apps: because I am a lazy F***, I
wrote little management command (still unfinished) that basically copies
the core app into your local project. Nothing fancy in what it does but
I found it quite helpful. Take a look at

https://gist.github.com/4621178

if you are interested. Feedback welcome, as usual. And if we can make it
part of Oscar when it has reached a more mature state, that would be
really awesome :)

Cheers,
Seb

--
Sebastian Vetter
Backend Developer

Tangent Snowball Australia
Suite 109
175 Sturt Street
Melbourne, VIC 3006

t. +61 (0) 3 9645 8796
e. sebastia...@tangentsnowball.com.au
Reply all
Reply to author
Forward
0 new messages