How do I update the Django database or model with results of an operation in js?

The math operation, I'm doing it on the front with js, but when it comes to wanting, that result, be updated in the database, I do not know, how to do, any suggestions please?

html file

{% extends "templates / base.html"%}
{% block content%}
{% load staticfiles%}
{% now "Y-m-d H: i: s"%} 
{{user.Peti}} {{user.numero_employed}}
{% csrf_token%}
Type of request: {{form.petit}}
Reason: {{form.razon}}
{{form.solicitudes_id}}
Start date: {{form.periodo_init}}
End date: {{form.periodo_fin}}
Enter days to take
Enter hours to take
Remember, that you have {{user.d_pendientes}} days and {{user.h_pendientes}} hours to compensate
{% endblock%}

That is, this is a draft, which I use as an example, but I would like to know, if I have to use ajax necessarily or if with django in the view, I can save the result of the

int.js

calculation function ()

{

   var dias = parseInt (document.getElementById ('dias'). value);
   var hours = parseFloat (document.getElementById ('hours'). value);
   var dias_base = parseInt (document.getElementById ('const_dias'). value);
   var base_hours = parseFloat (document.getElementById ('const_hours'). value);

   dias_base - = days;
   base_hours - = hours;

   alert (dias_base);
   alert (base_hours);
} console.log (calculation);

And this is the views.py with the following function

def solit (request):
    args = {'user': request.user}
    form = addiForm (request.POST)
    if request.method == 'POST':
        if form.is_valid ():
            form.save ()
        return redirect ('index')
    else:
        form = addiForm ()
    return render (request, 'templates / add.html', {'form': form}, args)

Database design – Automatically delete in a many-to-many relationship

Is there the possibility of eliminating unused / orphan entries in many-to-many relationships? Either at the level of the database (MSSQL) or in the frame (EF6).

Let's say you have a relationship:
Student to course
A student can have many courses, and several students can attend a course.
When the last student of a course is deleted, the course must also be deleted.

sql server: how to use grouping sets in this query that shows the sizes of the database, adding the last time it was updated

I have the following query that shows me the sizes of the database, including Log in dna data records.

SELECT [Database Name] = DB_NAME (s.database_id),

       [Type] = CASE WHEN s.Type_Desc = & # 39; ROWS & # 39; THEN & # 39; File (s) of data & # 39;

WHEN s.Type_Desc = & # 39; REGISTRATION & # 39; THEN & # 39; Record File (s) & # 39;

ELSE s.Type_Desc END,

- LastUpdate = (select COALESCE (max (last_user_update), MAX (last_system_update))
- from sys.dm_db_index_usage_stats dius
- where dius.database_id = s.database_id),

       [Size in MB] = CAST (((SUM (s.Size) * 8) / 1024.00) AS DECIMAL (18.2)),
       [Size in GB] = CAST (((SUM (s.Size) * 8) / 1024.00 / 1024.00) AS DECIMAL (18.2))

FROM sys.master_files s
- Uncomment if you need to consult a particular database
- WHERE database_id = DB_ID ('Name of the database')

GROUP BY GROUP SETS

(

(DB_NAME (s.database_id), s.Type_Desc),

(DB_NAME (s.database_id))

- (DB_NAME (s.database_id), s.database_id)

)

ORDER BY DB_NAME (s.database_id), s.Type_Desc DESC

TO GO

and that gives me the following image on one of my test servers:

enter the description of the image here

I would like to add the the last time the database was updated to the results of my query, as you can see in the lines commented in the previous query, but that gives me the following set of results:

SELECT [Database Name] = DB_NAME (s.database_id),

       [Type] = CASE WHEN s.Type_Desc = & # 39; ROWS & # 39; THEN & # 39; File (s) of data & # 39;

WHEN s.Type_Desc = & # 39; REGISTRATION & # 39; THEN & # 39; Record File (s) & # 39;

ELSE s.Type_Desc END,

LastUpdate = (select COALESCE (max (last_user_update), MAX (last_system_update))
from sys.dm_db_index_usage_stats dius
where dius.database_id = s.database_id),

       [Size in MB] = CAST (((SUM (s.Size) * 8) / 1024.00) AS DECIMAL (18.2)),
       [Size in GB] = CAST (((SUM (s.Size) * 8) / 1024.00 / 1024.00) AS DECIMAL (18.2))

FROM sys.master_files s
- Uncomment if you need to consult a particular database
- WHERE database_id = DB_ID ('Name of the database')

GROUP BY GROUP SETTINGS

(

(DB_NAME (s.database_id), s.Type_Desc),

(DB_NAME (s.database_id)),

(DB_NAME (s.database_id), s.database_id)

)

ORDER BY DB_NAME (s.database_id), s.Type_Desc DESC

TO GO

enter the description of the image here

How can I change my query to show the the last time the database was updated?

Database of content in SharePoint 2016 Online

No … you can not create the content database in Sharepoint online

The reason why SPO is the SAAS service in the cloud and you will not have control over which collection of sites goes where. Internally, you will create a content database for the collection of sites that you create or store in dB already created.

I'm not sure why you need it … if you can explain the reason behind doing this, there might be another way to do it.

sql server: restoration of the database created with the Wave tools from the Azure blob

I am exploring the use of Ola Hallengren's excellent backup tools to back up in a blue blob. Is there a simple way to restore the latest backups in a new MSSQL 2017 database directly from Azure Blob storage in MSSQL running on Linux containers (and if you could also handle the same process on a standard Windows machine, much better ?!) for development updates from production data? Can you point me in the right direction? I would love to be able to do all this from an SQL script, so I do not have to use a separate process to find out which is the latest backup, download, copy and start the restoration, so I can assign users directly after the restorations. they are complete (4 databases).

java – use the thread in a list with data from the database

Hello, I am trying to use a thread in a query that I do in the database that can generate many records
I do not know if it is necessary
but it does not return the values ​​in that list when I try to implement the subprocess (without the subprocess returns the values ​​normally)

my controller:
Here I call my method that will make this database include my DAO class:

public observable list refreshTable () {
DEFAULT dao = new DEFAULT ();
requisitions = FXCollections.observableArrayList (dao.getList ());
return requisitions;
}

my init in the controller:

public void initTable () {
new thread () {
@Override
public void run () {
clmIdReq.setCellValueFactory (new callback <CellDataFeatures, ObservableValue> () {
Public ObservableValue call (CellDataFeatures requisition) {
returns new SimpleObjectProperty (request.getValue (). getId ());
}
});
clmEquipment.setCellValueFactory (new callback <CellDataFeatures, ObservableValue> () {
Public ObservableValue call (CellDataFeatures requisition) {
return new SimpleObjectProperty (requisicao.getValue (). getReqEquipment (). getEquipment_name ());
}
});
clmSerial.setCellValueFactory (new callback <CellDataFeatures, ObservableValue> () {
Public ObservableValue call (CellDataFeatures requisition) {
return new SimpleObjectProperty (requisicao.getValue (). getReqEquipment (). getSerial_equipment ());
}
});
clmRequisitor.setCellValueFactory (new callback <CellDataFeatures, ObservableValue> () {
Public ObservableValue call (CellDataFeatures requisition) {
return new SimpleObjectProperty (requisicao.getValue (). getReqUser (). getNome ());
}
});
clmObservacao.setCellValueFactory (new Callback <CellDataFeatures, ObservableValue> () {
Public ObservableValue call (CellDataFeatures requisition) {
return new SimpleObjectProperty (requisicao.getValue (). getMotivo ());
}
});
clmStatus.setCellValueFactory (new callback <CellDataFeatures, ObservableValue> () {
Public ObservableValue call (CellDataFeatures requisition) {
return new SimpleObjectProperty (request.getValue (). getReqStatus (). getCategory ());
}
});
clmData.setCellValueFactory (new callback <CellDataFeatures, ObservableValue> () {
Public ObservableValue call (CellDataFeatures requisition) {
return new SimpleObjectProperty (requisicao.getValue (). getData_criada ());
}
});
tb.setItems (updateTable ());
}
} .start ();
}

my DAO method;

class publishes REQUESTEDO {

Private connection with;
Alerts alerts = new Alerts ();
PUBLIC APPLICATION () {
this.con = new ConnectionFactory (). getConnection ();
}

static request aRequestOption private;

RequestData static public getInstance () {

if (aRequest == null) {
aRequisitionOd = new REQUEST ();
}

return to RequisicaoDAO;
}
public list getList () {
List requisitions = new ArrayList <> ();
new thread () {
@Override
public void run () {
String sql = "SELECT * FROM equipreq equipreq INNER JOIN team_user equipuser ON (equipreq.idequipment_user = equipuser.id_user_equipment) INNER JOIN user ON (user.id_user = host.id).) INNER JOIN detail_status dStatus ON (dStatus.requisitionequipment = requreqequipmentequipment) INNER JOIN status_requisition statusreq in (statusreq.id_status = dStatus.idstatus) p. .Department = dp.id_departments) INNER JOIN department manager cp ON (dp.id_chefe = cp.id_chefe) where statusreq.category = & # 39; Active & # 39; ";
test {
PreparedStatement stmt = con.prepareStatement (sql);
ResultSet rs = stmt.executeQuery ();
while (rs.next ()) {
User User = new User ();
user.setName (rs.getString ("user.name"));
user.setId (rs.getLong ("user.id_user"));
user.setMatricula (rs.getString ("user.matricula"));
// FINAL USER TABLE
// team // team user tables
Team Team = New Team ();
equipment.setNode_equipment (rs.getString ("equipment.name_name"));
equipment.setSerial_equipment (rs.getString ("equipuser.serial_equipment"));
equipment.setId_User_equipment (rs.getLong ("equipmentequipment_user"));
// status table
State of state = new State ();
status.setCategory (rs.getString ("statusreq.category"));
status.setIdstatus (rs.getInt ("statusreq.id_status"));
// details of the state table
User userStatus = new User (); // user ID in the details state of the table
userStatus.setId (rs.getLong ("dStatus.iduser"));
StatusDetalhes statusDetalhes = new StatusDetails ();
statusDetalhes.setId_statusdetalhes (rs.getLong ("dStatus.id_statusdetalhes"));
statusDetalhes.setData_status (rs.getTimestamp ("dStatus.data"));
statusDetails.setObservation_status (rs.getString ("dStatus.observation"));
statusDetails.setIdUser (userStatus);
statusDetalhes.setIdStatus (status);
// Order ID in the details state of the table
Requisition requestStatus = new Requisition ();
requestStatus.setId (rs.getLong ("dStatus.requisition_equipment"));
// request table
Request req = new Requisition ();
req.setId (rs.getLong ("equipreq.id_requisition_equipment"));
req.setName (rs.getString ("equipreq.name"));
req.setData_create (rs.getTimestamp ("requreqdata_requirement"));
req.setMotivo (rs.getString ("equipreq.observacao"));
req.setReqEquipment (team);
req.setReqStatus (status);
req.setReqUser (user);
req.setReqStatus_Details (statusDetails);
requisicos.add (req);
}
stmt.close ();
rs.close ();
} catch (SQLException ex) {
Logger.getLogger (RequisitionData.class.getName ()). Log (Level.SEVERE, null, ex);
}

}
} .start ();
return requisitions;
}
}

it does not generate any errors, but this list does not appear in my table view.

Database storage based on Excel search

I am looking for a program to download all the results that can be obtained when searching in a database that only accepts numbers within a certain range to search. This is an example: http://natega1.youm7.com/ Once you enter a number between approximately (110000-700000), I think. The website shows the data corresponding to the code. The site is hosting the test results if you are wondering.

So, is there a program that can search all the results within a certain range and store them in a file like excel maybe? I'm not a programmer and I do not even know how to start looking for Google for this. Any help is appreciated.

By the way, I'm sorry for any misuse of the words.

woocommerce: Does WP-WooC support filters in the database?

Is it possible for WP-WooCommerce to add to the database some direct filters with restriction conditions, such as: if (table_users.user_role <1) and then (post_content = "register to see")? Does WP-WooC each request to the database have a user ID and a complete string? or are you collecting some data db? Or do not all the requests contain a user ID? Clarify, please!

wolfram cloud – How to load a relational database stored in WolframCloud?

I have a SQLite database with approximately 13 "tables" represented as a file and stored in WolframCloud with public permissions located at the following URL:

    chinook = "https://www.wolframcloud.com/obj/schandler/Public/chinook.sqlite";

I want to give him access and allow people to import the tables they want. Now, when that same database was hosted on my hard drive (or, actually, on my private Dropbox account), it was simple. I just did the following:

    schema = RelationalDatabase[FindFile[path<>"chinook.sqlite"]]

And that worked. But I have tried several permutations (and embarrassingly more) of the following, none of which works.

    Relational database[chinook];
Relational database[URL[URL[URL[URL[chinook]];
Relational database[CloudObject[CloudObject[CloudObject[CloudObject[chinook]];
Relational database[CloudGet[CloudObject[CloudGet[CloudObject[CloudGet[CloudObject[CloudGet[CloudObject[chinook]]];
Relational database[DatabaseReference[URL[DatabaseReference[URL[DatabaseReference[URL[DatabaseReference[URL[chinook]]];

Can someone help?

I would like to be able to allow people to access the entire database through RelationalDatabase[something] or tables in the database through RelationalDatabase[{table1,table2,…tablem},something]

And, yes, it could allow people to download the public cloud object file to their hard drive and write RelationalDatabase[FindFile[location]], but I REALLY want to keep that step for you. And, yes, I could make the file public in my Dropbox account, but I'd prefer to host it in WolframCloud for several reasons.

Thank you! (I'm doing cross-posts on community.wolfram.com because of the urgency)

python – How do I test a method that interacts with a database?

So I have a database class that has methods dedicated to specific actions. For example, I have below the method that accesses and writes to a table in the database:

def trackUserPerformance (self, verbform, verbsolution, erroneousUserInput, isVerbCorrect, date):

with oneself as db:
cursor = db.connection.cursor ()

cursor.execute
"INSERT INTO trackusersuccessfailure (verb form, verb, wrong user, status, date) VALUES"
"(% s,% s,% s,% s,% s)", (verb form, verbs solution, erroneous user input, isVerbCorrect, date))

self.connection.commit ()

The trackUserPerformance (…) method is a method within my database class. How, for example, to undo the query of the trackUserPerformance method (…) in the tests? Personally, I like the idea of ​​calling database methods as such:

db.specificMethod (...)

But it gets a bit challenging when I need to try those methods. My question is whether my approach is even a good practice, which means creating methods that are responsible for specific database queries like the previous method or if this is not a good idea because of that challenge