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