Created
December 7, 2017 18:34
-
-
Save anonymous/2aaef1b3a2633a6ccaadb4a92e79c249 to your computer and use it in GitHub Desktop.
cid.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def apply_cid(obj): | |
cids = models.CallerId.objects.filter(extension=obj).all() | |
for c in cids: | |
c.status = 1 | |
c.save() | |
class CidInLineAdmin(admin.TabularInline): | |
model = model.CallerId | |
extra = 0 | |
class ExtensionAdmin(admin.ModelAdmin): | |
list_display = ( | |
'extension', | |
'employee', | |
) | |
inlines = [ | |
CidInLineAdmin, | |
] | |
def save_model(self, request, obj, form, change): | |
obj.save() | |
apply_cid(obj) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment