I have a table model.
In one column of the table, the data is in the form - date-time. Dates may vary slightly.
How to compare the column of the model table through a loop or in some other way and (provided that the date in the column is less than a certain given date) delete the current row?
Delete those rows from the model if the value in the column (date time) of the table is less than the given one.
–
"value" = 2023-04-02 10:00:00
–
queryset_1_sorted = Model_1.objects.order_by("datetime" < "value")
–
datetime temper_1 temper_2 g_rashod temper_nv
0 2023-01-02 10:00:00 58.13 49.35 70.520 1.4
1 2023-01-02 11:00:00 57.44 49.12 89.805 1.4
2 2023-01-02 12:00:00 57.82 49.30 89.187 1.4
3 2023-01-02 13:00:00 58.08 49.62 89.079 1.4
4 2023-01-02 14:00:00 58.20 49.77 89.081 2.1
225 2023-10-02 19:00:00 65.67 53.90 87.998 -7.6
226 2023-10-02 20:00:00 66.80 54.98 87.970 -8.1
227 2023-10-02 21:00:00 67.37 55.53 87.946 -8.1
228 2023-10-02 22:00:00 67.76 55.87 87.973 -8.1
229 2023-10-02 23:00:00 68.02 56.09 87.942 -8.1