Delete Event from FullCalendar and also Django - django

Looking for a bit of direction after struggling to find anything googling..
I have implemented full calendar.io using django to store the events.
I can show the events and when the events are clicked, they open a modal, showing the data for that event.
In this modal, I want to include a delete button, I can pass the id of the event from django to the modal but I cannot figure out how to delete the entry from the django dB when the delete button is clicked..
Can someone please help?
Any direction would be appreciated!

Related

Refresh browser after modal dialog

My application calls a modal window from the navigation bar. The modal window has a pop-up LOV where the user selects an organization they wish to view data for. As soon as the change event occurs, the page is submitted, recording the new organization id and organization name into session state. The modal dialog is then closed.
The navigation bar displays the name of the organization that is stored in session state, making it simple for the user to tell which organization they are working with.
Since the modal to change organizations can be accessed from any page in the application, I need to be able to refresh the web browser to pick up the new organization name displayed in the nav bar once the modal has closed.
I've seen several posts online as to how to refresh a region or report once a modal closes, but I've not uncovered how to refresh the browser window, or perhaps alternatively, how to redirect back to the page where the user was when they accessed the modal via the nav bar.
How can this be achieved?
(Nav Bar displaying current context, and link to modal window)
#TineO - I was orginally thinking the same as you suggested, but the implementation wasn't coming together for me.
After further internet mining, I found this blog post which led me to a working solution, below. The bind variable :REFERRING_PAGE is a hidden field, which is populated by the link in the nav bar, using the configuration in the second image below.
You can create dynamic action or process which can work on 'click' action. You may just run 'submit page' or pl/sql or from a huge list of activities as per your need.
Hope this helps.

Retool: Action button to open modal with container

I have a table in retool. I've added an "action" column with buttons and renamed them "edit". What I would like to do on click of the action button is to open a modal with the data in the row populated. A user should be able to see the values of the row, edit them and when he clicks "submit" it will send an update API call for that row's unique id.
We’re working on some new docs for modal components, but until then here’s what you can do:
Drag a modal component onto your canvas. It’s going to appear as a button that opens a model, but don’t worry about that just yet
Create a Javascript query in the query editor that opens the modal. If we’re working with the default names, your query would be modal1.open()
Configure the action button in your table to run that JS query on click
That’s a quick way to open a modal through an action button. In terms of what’s in that modal, you can drag any components you want and reference table properties. So if you wanted to display a user’s email, you could drag a text component into the model and set its value to table1.selectedRow.data.email.
The last thing to deal with is the button, which you probably don’t want since you’re opening the modal via action buttons. You can hide it by clicking on it, heading to the inspector in the right sidebar, and scrolling down to the “display” settings. Just put true into the “Hide when true” field and the button won’t show.
hello stack overflow family this is my first post.
we are facing same issue today so i used one trick for opening a modal in action, i run one query that query name is model_open and in success event i select modal open and this query is triggered in Action edit option ,
i hope my first post help you ... :)

Django: Adding a confirmation dialog box after pressing the 'save' button in change_form

I would like to run a backend code after pressing the 'Save' button in the change_form (admin) screen, which will be followed by a confirmation dialog box which will ask something like 'nothing found, create new entity anyway?'
By pressing 'ok' in the dialog box the application will continue with the normal 'save' functionality. Pressing the 'cancel' button will throw us back to the change_form screen.
The workflow i'm trying to achieve is:
Press 'save' > run a python validation code > if code returns 'false' continue with the original 'save' functionality, else popup a dialog box > [dialog box] Ok > save the entity, cancel > stay on the change_form page.
Thanks for the help
Add a listener on the submit button with jQuery. Then fire off an Ajax request to the server to see if something has been found or not. Then display the dialog accordingly.
I was looking for something similar, to show a confirmation popup before updating some values and I found a library django-admin-confirm posting here for future explorers.

ember.js: catching url enter event

In ember.js I need to trigger a modal box create when I enter inside an URL, and to trigger its destruction when i leave it.
Do you know what events i can observe?
Will they be triggered in the controller or in the route?
And, finally, where can i find the documentation for this? I couldn't find any in ember.js site
I tried the enter and leave event, but they are triggered only once, and in the wrong moment
Thanks in advance
Look at activate and deactivate hooks on the Ember.Route.
http://emberjs.com/api/classes/Ember.Route.html

django POST [Legitimacy]

Lets say I have a web application that displays 2 random buttons on each session, and I want the user to click on 1 button or the other. If a button is clicked, I want to increment the score for that button. However, the user has no control on what 2 buttons are presented each time and there are thousands of possible buttons.
If I create a view to increment the button, how would I be sure that the user wont just manually go to that view through the browser.
My thoughts are that you need to create a form and have users POST to a certain address, but how do you know that the user didn't just send a post request through AJAX to increment the button and that the user actually received that button from the randomized session with 2 buttons.
How would I handle this in Django is there documentation detailing how Django specifically supports this?
EDIT: Or do you have to create a unique session ID for each button selecting session and check each button click against the unique session ID.
Create a session variable to track the button they see, like:
def button_display_view(request):
# ...lots of cool logic
session['buttons_shown'] = [button_1_primary_key, button_2_primary_key]
return response
Then, in your button click view, ensure that the button clicked was in the list of buttons that they were shown. The user will have zero knowledge of your session variable, nor be able to edit it, much like he/she can't when you use session variables to track authentication, etc.
If you're building a multivariate testing system (or even an AB testing system), it might be worth checking out this MVT app for ideas.