Skip to content

Commit c7aa2a4

Browse files
author
drew
committed
Create update log
1 parent f4a1244 commit c7aa2a4

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

guide/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,10 @@ class tourArtwork(models.Model):
139139
exhibition = models.ForeignKey('Exhibition', on_delete=models.CASCADE, db_column='exhibition_uuid')
140140
tour = models.ForeignKey('Tour', on_delete=models.CASCADE, db_column='tour_uuid')
141141
artwork = models.ForeignKey('Artwork', on_delete=models.CASCADE, db_column='artwork_uuid')
142+
143+
#Updates - only used for debugging updates
144+
145+
class Update(models.Model):
146+
updated_at = models.DateTimeField(auto_now_add=True)
147+
descrip = models.CharField(max_length=255, null=True, blank=True)
148+
success = models.BooleanField(default=False)

guide/services/update_data.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import re
66
from django.utils.text import slugify
77
from django.conf import settings
8-
from guide.models import Location, Category, Exhibition, Tour, Artist, Link, Artwork, Media, artistArtwork, tourArtwork
8+
from guide.models import Location, Category, Exhibition, Tour, Artist, Link, Artwork, Media, artistArtwork, tourArtwork, Update
99

1010
#Functions
1111
def import_items(obj, data):
@@ -203,6 +203,14 @@ def update_data_CMS():
203203
import_items(obj, e)
204204
obj.save()
205205

206+
#Write to update table
207+
print "\nLogging update"
208+
209+
u = Update()
210+
u.descrip = 'update_data'
211+
u.success = True
212+
u.save()
213+
206214
print "\nDone!"
207215

208216
if __name__ == "__main__":

guide/services/update_hours.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33
import pprint
44
import re
5-
from guide.models import Hour
5+
from guide.models import Hour, Update
66
from django.conf import settings
77

88

@@ -24,6 +24,10 @@ def update_hours_CMS():
2424
h.day_close = value['close']
2525
h.save()
2626

27+
u = Update()
28+
u.descrip = 'update_hours'
29+
u.success = True
30+
u.save()
2731

2832
print "\nDone!"
2933

0 commit comments

Comments
 (0)