restored strokedata temporarily
This commit is contained in:
@@ -2850,20 +2850,20 @@ def update_duplicates_on_delete(sender, instance, **kwargs):
|
|||||||
|
|
||||||
|
|
||||||
# Delete stroke data from the database when a workout is deleted
|
# Delete stroke data from the database when a workout is deleted
|
||||||
@receiver(models.signals.post_delete,sender=Workout)
|
#@receiver(models.signals.post_delete,sender=Workout)
|
||||||
def auto_delete_strokedata_on_delete(sender, instance, **kwargs):
|
#def auto_delete_strokedata_on_delete(sender, instance, **kwargs):
|
||||||
if instance.id:
|
# if instance.id:
|
||||||
query = sa.text('DELETE FROM strokedata WHERE workoutid={id};'.format(
|
# query = sa.text('DELETE FROM strokedata WHERE workoutid={id};'.format(
|
||||||
id=instance.id,
|
# id=instance.id,
|
||||||
))
|
# ))
|
||||||
engine = create_engine(database_url, echo=False)
|
# engine = create_engine(database_url, echo=False)
|
||||||
with engine.connect() as conn, conn.begin():
|
# with engine.connect() as conn, conn.begin():
|
||||||
try:
|
# try:
|
||||||
result = conn.execute(query)
|
# result = conn.execute(query)
|
||||||
except:
|
# except:
|
||||||
print("Database Locked")
|
# print("Database Locked")
|
||||||
conn.close()
|
# conn.close()
|
||||||
engine.dispose()
|
# engine.dispose()
|
||||||
|
|
||||||
# Virtual Race results (for keeping results when workouts are deleted)
|
# Virtual Race results (for keeping results when workouts are deleted)
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
@@ -3073,9 +3073,9 @@ attrs.update(strokedatafields)
|
|||||||
# when the StrokeData are expanded.
|
# when the StrokeData are expanded.
|
||||||
# No Django Instances of this model are managed. Strokedata table is
|
# No Django Instances of this model are managed. Strokedata table is
|
||||||
# accesssed directly with SQL commands
|
# accesssed directly with SQL commands
|
||||||
#StrokeData = type(str('StrokeData'), (models.Model,),
|
StrokeData = type(str('StrokeData'), (models.Model,),
|
||||||
# attrs
|
attrs
|
||||||
# )
|
)
|
||||||
|
|
||||||
# Storing data for the OTW CP chart
|
# Storing data for the OTW CP chart
|
||||||
class cpdata(models.Model):
|
class cpdata(models.Model):
|
||||||
|
|||||||
Reference in New Issue
Block a user