Code Monkey home page Code Monkey logo

Comments (5)

alesdotio avatar alesdotio commented on June 3, 2024

Hey, thanks for using my app :D. I'm just not entirely sure HOW you are using it. Since the context should always be available in the admin, I assume you must be using the template tag directly, on some other page than the admin. I'm really interested since I never thought about using it for anything else :)

from django-admin-shortcuts.

kikin81 avatar kikin81 commented on June 3, 2024

Hey, thanks for writing this app. I am also having that same error: KeyError: Context.
Do you mind explaining how to set up the "context"?

from django-admin-shortcuts.

benvand avatar benvand commented on June 3, 2024

Hey guys,
Alesdotio was correct, 'the context should always be available in the admin'. What I was doing was expanding the admin to include some more pages which is what I guess Kikin81 is doing too. Now the pages I was adding didn't technically count as admin pages as I was using another app to create them. Although I can't remember which now because I eventually took a different route with that site. (Still using admin-shortcuts!)

...(goes to look at site)...

That's right, I was using dbsettings (https://github.com/sciyoshi/django-dbsettings) Which created new pages and tables in the db used to edit global site settings instead of lumping stuff in the settings.py
The problem is that these pages weren't strictly admin pages and the context wasn't passed through to them. This meant that when admin-shortcuts wanted to use the context it couldn't find it.

I ended up dropping dbsettings because it wasn't quite as versatile as what I wanted. I ended up creating models wherein the the site itself was a foreign key and the settings attributed to that key (I have examples if wanted).

Alesdotio, do you find that having the context in there is particularly beneficial? The problem being that it ties the use of the app to the django admin as opposed to being able to use it elsewhere. Obviously the name of the app is admin-shortcuts so it is implied that it provides shortcuts for the admin! But food for thought I guess.

from django-admin-shortcuts.

alesdotio avatar alesdotio commented on June 3, 2024

the context was added in this pull request #5

from django-admin-shortcuts.

alesdotio avatar alesdotio commented on June 3, 2024

Now it shouldn't raise a KeyError anymore. Does that help?

from django-admin-shortcuts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.