CheckGrappelli WTF? :D #10

Closed
ghost opened this Issue Nov 5, 2012 · 3 comments

Projects

None yet

2 participants

@ghost
ghost commented Nov 5, 2012

I mean, come on, you can't be serious. Checking the availability using a templatetag?

Just add dependencies towards Grapelli, if you really need it, and raise an Exception in case that it cannot be found on the include path. But, hell, no tag for that, please.
Besides, the tag alone will not help as you actually need two separate code bases or paths in your views to either create grappelli based dashboards etc. or the standard, more generic admin views and presentations thereof.

So, please, refactor the existing tag into something more obsolete and then reconsider, perhaps by introducing a function
that will return whether or not grapelli was enabled in INSTALLED_APPS.

From there, you can then evolve by deciding to either render the standard admin templates or the grapelli enabled ones... in your view/controller that is, with no tag being involved.

Example:

def view(....):
    if grapelli_is_enabled:
        return render('grapelli_view.xhtml'...)
    return render('standard_view.xhtml'...)
@rozza
Contributor
rozza commented Nov 6, 2012

I cant really comment on that, it shows the origins of the code base. I havent any experience with Grapelli but will look into the integration and look to make that cleaner.

@ghost
ghost commented Mar 20, 2013

is this still an issue or can we close this?

@last-partizan
Contributor

It think we should leave grapelli check in template, it's simple and it works. Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment