36
36
from esp .program .modules .handlers import *
37
37
from django .db .models import Q
38
38
39
- #from django.contrib import admin
40
- #from django.db import models
41
- #from esp.program.models import Program
42
- #
43
- #class DBReceipt(models.Model):
44
- # """ Per-program Receipt templates """
45
- # program = models.OneToOneField(Program)
46
- # receipt = models.TextField()
47
- #
48
- #admin_site.register(DBReceipt)
49
-
50
-
51
39
def updateModules (update_data , overwriteExisting = False , deleteExtra = False , model = None ):
52
40
"""
53
41
Given a list of key:value dictionaries containing fields from the
@@ -89,7 +77,7 @@ def updateModules(update_data, overwriteExisting=False, deleteExtra=False, model
89
77
for (datum , (mod , created )) in mods :
90
78
ids .append (mod .id )
91
79
92
- # ProgramModule.objects.exclude(id__in=ids).delete()
80
+ ProgramModule .objects .exclude (id__in = ids ).delete ()
93
81
94
82
for (datum , (mod , created )) in mods :
95
83
# If the module exists but the provided data adds fields that
@@ -114,6 +102,6 @@ def install(model=None):
114
102
for module in modules :
115
103
table_data += module .module_properties_autopopulated ()
116
104
117
- updateModules (table_data , model = model )
105
+ updateModules (table_data , deleteExtra = True , model = model )
118
106
119
107
from esp .program .modules .module_ext import *
0 commit comments