Giter VIP home page Giter VIP logo

Comments (3)

leetucker avatar leetucker commented on May 18, 2024

OK, I looked into this some more. When one adds or changes an instance, Django's admin does indeed call back to the parent window of the id and name of the Location that has been added or changed. There might be a way to just fire off an Ajax call when this callback happens (by creating an event handler for whenever the select options for the location are modified).

However, I think that it may make sense to just override the default callback process entirely. Here's how that would work:

  • In danceschool.core.admin, in the LocationAdmin class Override the ModelAdmin methods response_add() and response_change() to pass along not just the name and id of the added/modified location, but also the capacity information and room listing for that location. Also, change the methods to return a modified version of templates/admin/response_popup.html
  • The response template templates/admin/response_popup.html just returns a simple HTML document with included Javascript from static/admin/js/popup_response.js. Change this document to call a modified version of this file.
  • The current version of static/admin/js/popup_response.js just calls the functions dismissAddRelatedObjectPopup() and dismissChangeRelatedObjectPopup() from static/admin/js/admin/RelatedObjectLookups.js. Instead, call a modified version of these functions that not only adds/modifies the ID and name of the added/changed Location instance, but that also loads in the passed defaultCapacity and room data if it is provided.

I don't have time to take this on immediately, but we should definitely go ahead and get this bug fixed before the rooms branch is merged into master.

from django-danceschool.

leetucker avatar leetucker commented on May 18, 2024

Actually, I was able to get this modified and operational. The associated update has been pushed to the rooms branch.

from django-danceschool.

leetucker avatar leetucker commented on May 18, 2024

I think this has been adequately tested on the rooms branch, so I'm closing it.

from django-danceschool.

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.